Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Embed Image in HTML Email
Demonstrates how to create and send an HTML email with an embedded image. LOCAL loMailman LOCAL lnSuccess LOCAL loEmail LOCAL lcFileOnDisk LOCAL lcFilePathInHtml LOCAL lcHtmlBody * 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') * Add an embedded image to the HTML email. lcFileOnDisk = "images/dude2.gif" lcFilePathInHtml = "something/dudeAbc.gif" * Embed the GIF image in the email. lnSuccess = loEmail.AddRelatedFile2(lcFileOnDisk,lcFilePathInHtml) IF (lnSuccess <> 1) THEN =MESSAGEBOX(loEmail.LastErrorText) QUIT ENDIF * The src attribute for the image tag is set to the filePathInHtml: lcHtmlBody = [<html><body>Embedded Image:<br><img src="something/dudeAbc.gif"></body></html>] * Set the basic email stuff: HTML body, subject, "from", "to" loEmail.SetHtmlBody(lcHtmlBody) loEmail.Subject = "Visual FoxPro HTML email with an embedded image." loEmail.AddTo("Admin","admin@chilkatsoft.com") loEmail.From = "Chilkat Support <support@chilkatsoft.com>" 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-2010 Chilkat Software, Inc. All Rights Reserved.
Mail Component · .NET Email Component · ASP Mail Component · XML Parser