Recommended: 10 experience summary of ASP development After half a year, I completed the management information system of a bureau-level unit alone, and released a total of 29 BETA versions and 3 official versions. asp oracle environment, 285 ASP files, functions involve data entry, modification, fuzzy query, automatic statistics, data analysis and reporting.
Many examples of JMail sending emails on the Internet do not write about how to send attachments, or do not write about how to send embedded attachments (such as embed attachment images into HTML letters)
In fact, the most important thing is that this sentence needs to be commented out
'JMail.ContentType = text/html
(Why do you need to post embedded attachment pictures? Because if it is img src=on the address, it will show an ugly X in clients such as outlook, and you need to download the picture manually)
This example refers to the example of Dimac (w3JMail official), file address:
C:/Program Files/Dimac/w3JMail4/Examples/ASP/htmlimage.asp
(There are all those who have Jmail installed)
Example code:
| The following is the quoted content: <% Set JMail = Server.CreateObject(JMail.Message) 'Whether to encode the letterhead into iso-8859-1 character set. The default is True JMail.ISOEncodeHeaders = True 'If JMail.silent is set to true, ErrorCode contains the error code JMail.Silent = True 'Set the title and content encoding. If the title has Chinese, the encoding must be set to gb2312 JMail.Charset = gb2312 'JMail.ContentType = text/html 'If you send embedded attachments, you must comment out this line, it is important! JMail.From = [email protected] ' Sender address JMail.FromName = Skyhe System ' Sender name JMail.MailServerUserName = web ' Authenticated Username JMail.MailServerPassword = 123456 ' Authentication Password 'Add a new recipient JMail.AddRecipient [email protected], Mr.Example 'JMail.AddRecipientBCC Email' Address of the recipient of the password 'JMail.AddRecipientCC Email'The address of the cc user JMail.Subject = Image Test! ! ! JMail.Body = A nice picture if you can read HTML-mail. 'Add a normal attachment JMail.AddAttachment(Server.MapPath(images/email.gif)) 'Add an embedded accessory ' The return value of AddAttachment is used as a ' reference to the image in the HTMLBody. 'contentId = JMail.AddAttachment(Server.MapPath(images/email.gif)) Dim contentId contentId = JMail.AddAttachment(E:/images/email.gif) 'Only HTML format supports embedded image attachments, we use HTML format email content ' As only HTML formatted emails can contain inline images ' we use HTMLBody and appendHTML JMail.HTMLBody = <html><body><font color=red>Hi, here is a nice picture:</font><br> JMail.appendHTML <img src=cid: & contentId & > JMail.appendHTML <br><br> good one huh?</body></html> 'If the other party's mailbox does not support HTML format email, we still need to give him a friendly prompt ' But as not all mailreaders are capable of showing HTML emails ' we will also add a standard text body JMail.Body = Too bad you can't read HTML-mail. JMail.appendText There would have been a nice picture for you JMail.Send(mail.skyhe.com) JMail.Close() Set JMail = Nothing %> |
Share: Comparison of ASP, PHP and JSP With the rapid development of the Internet today, people are constantly innovating, including the development of web pages and websites. The original HTML hypertext language can no longer fully meet our needs for making web pages. What we need is a website with strong dynamic and interactive nature. This is how we can be with the vast majority.