Add an embedded image file to current email with customized file name
[Syntax] Visual C++: HRESULT AddInlineEx(BSTR FileName, BSTR strAlt, BSTR* pVal) Visual Basic: AddInlineEx(FileName As String, strAlt As String) As String
Parameters
Return Value
Remarks
Example
[Visual Basic] To get the full samples of EASendMail, please refer to Samples section.
[VB6, VBA - Send Email with Embedded Images] Const ConnectNormal = 0 Const ConnectSSLAuto = 1 Const ConnectSTARTTLS = 2 Const ConnectDirectSSL = 3 Const ConnectTryTLS = 4 Private Sub SendEmail() Dim oSmtp As EASendMailObjLib.Mail Set oSmtp = New EASendMailObjLib.Mail oSmtp.LicenseCode = "TryIt" ' Your SMTP server address oSmtp.ServerAddr = "smtp.emailarchitect.net" ' User and password for ESMTP authentication oSmtp.UserName = "test@emailarchitect.net" oSmtp.Password = "testpassword" ' ConnectTryTLS means if server supports SSL/TLS connection, SSL/TLS is used automatically oSmtp.ConnectType = ConnectTryTLS oSmtp.FromAddr = "test@emailarchitect.net" oSmtp.AddRecipient "Support Team", "support@adminsystem.com", 0 oSmtp.BodyFormat = 1 'html email body oSmtp.Subject = "Test" Dim cid As String ' Add embedded picture and return the unique identifier of the attachment cid = oSmtp.AddInlineEx("c:\test.gif", "mytest.gif") If cid = "" Then MsgBox "add embedded picture failed" MsgBox oSmtp.GetLastErrDescription() Exit Sub End If ' use the cid as link in the body text oSmtp.BodyText = "<html><body>Hello, this is a inline <img src=""cid:" & cid & """ > picture." If oSmtp.SendMail() = 0 Then MsgBox "Message delivered!" Else MsgBox oSmtp.GetLastErrDescription() End If End Sub
Online Examples
Visual C++ - Send HTML Email with Embedded Images
Visual Basic - Send HTML Email with Embedded Images
Delphi - Send HTML Email with Embedded Images
See Also