Description
Adds an resource linked from the HTML.
Applies to
Syntax
mimemessage.AddLinkedResource(string linkedresource, string contentid)
Argument |
Description |
---|---|
mimemessage |
A MimeMessage object identifying the email message in which you want to add an resource linked from the HTML. |
linkedresource |
A string that sets the HTML linked resource. |
contentid |
A "cid:" URI in an HTML-formatted message body. |
Return value
Integer.
Returns the index number if it succeeds and -1 if file does not exist. If any argument's value is null, the method returns null.
Examples
The following example sets the email information and the HTML linked resource.
Integer li_rc String ls_linkedResources, ls_contentID,ls_HTML_file SMTPClient lnv_SmtpClient lnv_SmtpClient = CREATE SMTPClient //set the email account information lnv_SmtpClient.Host = "smtp.gmail.com" lnv_SmtpClient.Port = 587 lnv_SmtpClient.Username = "tester001.appeon@gmail.com" lnv_SmtpClient.password = "Mypassword001" lnv_SmtpClient.EnableTLS = True lnv_SmtpClient.LogFile("c:\mail.log") //set the email message lnv_SmtpClient.Message.SetSender("tester001.appeon@gmail.com","Tester001") lnv_SmtpClient.Message.AddRecipient("tester002.appeon@gmail.com") lnv_SmtpClient.Message.Subject = "SMTPClient Test Message" //set the HTML linked resource ls_linkedResources = "c:\\image\\appeon.jpg" ls_contentID = "CID001" lnv_SmtpClient.Message.AddLinkedResource(ls_linkedResources, ls_contentID) ls_HTML_File = & "<html><body>" + "~r~n" + & "<p>This is the inline " + "~r~n" + & "<b>HTML</b> message of the e-mail.</p><br />" + "~r~n" + & "<img src='cid:" + ls_contentID + "'/>" + "~r~n" + & "</body></html>" lnv_SmtpClient.Message.HTMLBody = ls_HTML_File //send the email li_rc = lnv_SmtpClient.Send() IF li_rc = 1 THEN Messagebox('SMTPClient','Mail sent successfully') ELSE Messagebox('SMTPClient' ,'Email sending failed. Return ' + String(li_rc) + '.', StopSign!) END IF DESTROY lnv_SmtpClient
See also