Attach a file or URL as attachment to current email with customized file name.
[Syntax] C++: HRESULT AddAttachmentEx(BSTR strFile, BSTR strAlt, long* pVal) Visual Basic: AddAttachmentEx(strFile As String, strAlt As String) As Long
Parameters
Return Value
Remarks
Example
[Visual Basic] To get the full samples of EASendMail, please refer to Samples section.
[VB6, VBA - Send Email with Attachment]
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@emailarchitect.net", 0
oSmtp.BodyText = "Hello, this is a test...."
If oSmtp.AddAttachmentEx("c:\test.doc", "mytest.doc") <> 0 Then
MsgBox "failed to add attachment"
MsgBox oSmtp.GetLastErrDescription()
Exit Sub
End If
If oSmtp.SendMail() = 0 Then
MsgBox "Message delivered!"
Else
MsgBox oSmtp.GetLastErrDescription()
End If
End Sub
See Also
AddAttachment Method
AddInline Method
ImportHtml
ImportMailEx
Online Examples
VB6- Send Email with Attachment
VB6 - Send Email with Embedded Images
Delphi - Send Email with Attachment
Delphi - Send Email with Embedded Images
Visual C++ - Send Email with Attachment
Visual C++ - Send Email with Embedded Images