Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
|
Add Email Attachment from String Variable
Adds 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 |
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.
Mail Component · .NET Email Component · ASP Mail Component · XML Parser