Newsgroup: it.comp.lang.visual-basic
Titolo: help attachment a mail da vb

leggendo qua e la nel newsgroup ho visto un messaggio che indicava un sito:
http://www.vb2themax.com/Item.asp?PageID=TipBank&ID=100
dove si trova un esempio (che riporto qui sotto) che era in grado di mandare
mail da vb;
cosi e, ma il mio problema e fare l'attachment di un file in modo
automatico come si fa?
ESEMPIO del sito
*********************************
The ShellExecute API function recognizes email addresses if they are
prefixed by the "mailto:" prefix, and correctly run the default program for
sending email messages (e.g. Outlook). This lets you open a window for
sending an email and automatically fill the address field. Here's a wrapper
routine that encapsulates the low-level details:
Private Declare Function ShellExecute Lib "shell32.dll" Alias
"ShellExecuteA" _
    (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As
String, _
    ByVal lpParameters As String, ByVal lpDirectory As String, _
    ByVal nShowCmd As Long) As Long
' Open the default program for sending email messages
' Returns True if successful, False otherwise
Public Function OpenEmailProgram(ByVal EmailAddress As String) As Boolean
    Dim res As Long
    res = ShellExecute(0&, "open", "mailto:" & EmailAddress, vbNullString, _
        vbNullString, vbNormalFocus)
    OpenEmailProgram = (res > 32)
End Function
You should always check the return value of the function, in case no program
has been registered on the machine:
If Not OpenEmailProgram("
user...@domain.com
") Then
    MsgBox "Unable to run the email program"
End If
UPDATE: It turns out that you can even provided the contents for other mail
fields, by passing additional values on the URL. The following updated
version of the routine above supports a subject, the body of the message and
a CC mail address. All these added arguments are optional:
Sub OpenEmailProgram(sDest As String, Optional sSubject As String, _
    Optional sBody As String, Optional sCC As String)
    ShellExecute 0, vbNullString, "mailto:" & sDest & "?subject=" & sSubject
& _
        "&body=" & sBody & "&CC=" & sCC & "&attachment=c:\autoexec.bat", 0&,
0&, _
        1
End Sub
' how to use:
SendMail "
mbell...@vb2themax.com
", "SendMail Test", "The function
works!!!", _
    "
fba...@vb2themax.com
, 
desp...@vb2themax.com
"

 automatico come si fa?
piero
1. postare lo stesso messaggio 3 volte in brevissimo tempo aumenta le
probabilita' non che qno risponda ma che qno non gradisca.
2. qui sotto sono un po' di link di argomento simile dai siti vb che mi sono
scaricato. magari vai un po' a vedere. gli url li puoi ricavare dalle dir.
hth, pal
c:\tp_prg\_vb\vb-helper\
www.vb-helper.com
\howto
sendmail zip         2.500  10/02/00   0.25 sendmail.zip
c:\tp_prg\_vb\vb-square\
www.vbsquare.com
\downloads
sendmail zip        95.632  22/09/99  16.18 sendmail.zip
c:\tp_prg\_vb\vb-square\
www.vbsquare.com
\tut
sendmail htm        28.165  23/09/99  16.51 sendmail.htm
c:\tp_prg\_vb\vb_dufield\
members.tripod.com
\~paul_du\download
sendmail zip         1.776  16/08/99  10.08 sendmail.zip
c:\tp_prg\_vb\vb-raimondo\
www.arcadiaonline.it
\altro\visualbasic\sorgenti\co
municazione
smtp2    zip         3.032  17/09/99  11.34 smtp2.zip
smtp1    zip         4.018  17/09/99  11.34 smtp1.zip
c:\tp_prg\_vb\vb_microtech\
members.xoom.com
\_xoom\microtech
smtp     htm         4.736  16/08/99  10.29 smtp.htm
smtplog  gif         5.946  16/08/99  10.19 smtplog.gif
smtp     zip        23.207  16/08/99  10.19 smtp.zip
smtpsc~1 gif        28.058  16/08/99  10.19 smtpscreenshot.gif
c:\tp_prg\_vb\_it_lang_vb2\
www.murialdo.it
\it_lang_vb\prj
smtp     zip        16.974  13/01/00  15.12 smtp.zip

i ringraziamenti