Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
E-mails with Inline Attachments from VFP
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
West Wind Web Connection
Titre:
E-mails with Inline Attachments from VFP
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01034334
Message ID:
01034334
Vues:
65
Hi All

Does anyone know how to send Inline Attachments from VFP.

I can successfully send ordinary attachments using SendMail() but have not been able to workout how to send a graphic as an 'inline attachment' (as Outlook does).

I found some VB code that does what I want, but don't have the necessary skills to implement it in VFP.

I'm still learning VFP coming from DOS/Windows but finding the learning curve quite steep.

Here's the code:

Any help with this one would be greatly appreciated.

Graham
* --------------------------------------------------------------------

Private Sub EmbeddingImages()
    Dim msg As MailMessage = New MailMessage
 
    msg.To.Add("Bob User", "bob@example.com")
    msg.From.Name = "John Doe"
    msg.From.EMail = "john@example.com"
    msg.Subject = "Meeting request"
 
    ' Images can be embedded into the html message
    ' using special image src properties with "cid:"
    ' Note that "picture1" and "picture2" identifiers
    ' are later used while adding the pictures.
    msg.HTMLMessage.Body = "Bob, this is me: " & "<img src='cid:picture1'>" & "and my brother:<img src='cid:picture2'>"
 
    ' Attach the inline pictures with cid references
    msg.AttachInlineFile("C:\me.jpg", "me", "picture1")
    msg.AttachInlineFile("C:\\bro.jpg", "bro", "picture2")
 
    msg.SMTPServer.Host = "localhost"
 
    If msg.Send() Then
        Console.WriteLine("Message has been sent successfuly.")
    Else
        Console.WriteLine("Error: " + msg.SMTPServer.LastError)
    End If
End Sub

* --------------------------------------------------------------------
Répondre
Fil
Voir

Click here to load this message in the networking platform