Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ Delphi FoxPro Java Perl Python Ruby SQL Server VBScript
|
Add Email Attachment from String VariableAdds an text attachment to an email from a string variable.
LOCAL loMailman LOCAL lnSuccess LOCAL loEmail LOCAL lcAttachmentContent * The mailman object is used for sending and receiving email. loMailman = CreateObject('Chilkat.MailMan2') * Any string argument automatically begins the 30-day trial. lnSuccess = loMailman.UnlockComponent("30-day trial") IF (lnSuccess <> 1) THEN =MESSAGEBOX("Component unlock failed") QUIT ENDIF * Set the SMTP server. loMailman.SmtpHost = "smtp.comcast.net" * Create a new email object loEmail = CreateObject('Chilkat.Email2') loEmail.Subject = "This is a test" loEmail.Body = "This is a test" loEmail.From = "Chilkat Support <support@chilkatsoft.com>" loEmail.AddTo("Chilkat Admin","admin@chilkatsoft.com") lcAttachmentContent = "This is the content of a text attachment" * The last argument indicates the charset to use for the attached text. * The string is converted to this charset and attached to the email as a text file attachment. * The charset can be anything: "utf-8", "iso-8859-1", "shift_JIS", "ansi", etc. loEmail.AddStringAttachment2("myFile.txt",lcAttachmentContent,"ansi") lnSuccess = loMailman.SendEmail(loEmail) IF (lnSuccess <> 1) THEN =MESSAGEBOX(loMailman.LastErrorText) ELSE =MESSAGEBOX("Mail Sent!") ENDIF |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2007 Chilkat Software, Inc. All Rights Reserved.
Mail Component · .NET Email Component · ASP Mail Component · XML Parser