- Products
- Purchase
Order Online Maintenance Renewal Resellers - Support
Helpdesk Online Documentation Web Forum - Our Clients
- About
About us Services Contact
Back to Tutorials list
Send Method
Back to Tutorials list
Adding attachments
The sample sends plain-text e-mail with 2 attachments.
First attachment is placed into the message under its natural name. Second attachment is placed under different name (this is often used when attachments are added from temporary files).
SMTP.AddAttachment is a key property of the sample.
For simplicity, SMTP authentication is not used and no error-checking is performed.
[Visual Basic]:
Dim objSMTP
' Create mailer component
Set objSMTP = CreateObject("MailBee.SMTP")
' Unlock SMTP component
objSMTP.LicenseKey = "put your license key here"
' Set SMTP server name
objSMTP.ServerName = "mail.server.com"
' Set message properties
objSMTP.FromAddr = "me@mydomain.com"
objSMTP.ToAddr = "you@yourdomain.com"
objSMTP.Subject = "Hi"
objSMTP.BodyText = "This is test message with attachments"
' Add attachment from "file1.doc" file.
' It will appear as "file1.doc" in the e-mail.
objSMTP.AddAttachment "C:\files\file1.doc"
' Add attachment from "file2.tmp" file.
' It will appear as "renamed.doc" in the e-mail.
objSMTP.AddAttachment "C:\files\file2.tmp", , ,"renamed.doc"
' Send it!
objSMTP.Send
[ASP]:
<%
Dim objSMTP
' Create mailer component
Set objSMTP = Server.CreateObject("MailBee.SMTP")
' Unlock SMTP component
objSMTP.LicenseKey = "put your license key here"
' Set SMTP server name
objSMTP.ServerName = "mail.server.com"
' Set message properties
objSMTP.FromAddr = "me@mydomain.com"
objSMTP.ToAddr = "you@yourdomain.com"
objSMTP.Subject = "Hi"
objSMTP.BodyText = "This is test message with attachments"
' Add attachment from "file1.doc" file.
' It will appear as "file1.doc" in the e-mail.
objSMTP.AddAttachment "C:\files\file1.doc"
' Add attachment from "file2.tmp" file.
' It will appear as "renamed.doc" in the e-mail.
objSMTP.AddAttachment "C:\files\file2.tmp", , ,"renamed.doc"
' Send it!
objSMTP.Send
%>
See Also:Send Method