There are many examples on the internet that jmail send emails without writing an attachment, or how to send an inline attachment (such as embedding an attachment picture inside an HTML letter).
In fact, the most important thing is to comment out
' Jmail.contenttype = ' text/html '
(Why do you want to send an inline attachment picture?) because if it is an IMG src= online address, in Outlook and other clients will show an ugly "X", you need to manually download the picture)
This example refers to the Dimac (W3jmail official) sample, file address:
C:\Program files\dimac\w3jmail4\examples\asp\htmlimage.asp
(All of the JMail are installed)
Example code:
The following is a reference fragment:
<%
Set JMail = Server.CreateObject ("Jmail.message")
' Whether to encode the letterhead into the iso-8859-1 character set. The default is True
Jmail.isoencodeheaders = True
' If Jmail.silent is set to True,errorcode contains an error code
Jmail.silent = True
' Set the title and content encoding, if the title has Chinese, you must set the encoding to gb2312
Jmail.charset = "gb2312"
' Jmail.contenttype = ' text/html ' If an inline attachment must be commented out this line, important!
Jmail.from = "web@mail.skyhe.com" ' Sender address
Jmail.fromname = "skyhe System" ' Sender name
Jmail.mailserverusername = "Web" Authenticated user name
Jmail.mailserverpassword = "123456" Authenticated password
' Add a new recipient
Jmail.addrecipient "kittow@mail.skyhe.com", "Mr.example"
' JMAIL.ADDRECIPIENTBCC email ' confidential recipient's address
Address of CC of ' JMAIL.ADDRECIPIENTCC email '
Jmail.subject = "Picture Test!!! "
Jmail.body = "A nice picture if you can read html-mail."
' Add an ordinary attachment
Jmail.addattachment (Server.MapPath ("Images/email.gif"))
' Add an embedded attachment
' 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 embedding picture attachments, we use HTML-formatted message content
' As only HTML formatted emails can contain inline images
' We use HTMLBody and appendhtml
Jmail.htmlbody = "jmail.appendhtml " "
Jmail.appendhtml "<br><br> good one huh?</body>' If the mailbox does not support HTML format mail, we still need to give him a friendly hint
' But as not all mailreaders are capable of showing HTML emails
' We'll also add a standard text body
Jmail.body = "Too bad for You can ' t read html-mail."
Jmail.appendtext "There would have been a nice to you"
Jmail.send ("mail.skyhe.com")
Jmail.close ()
Set JMail = Nothing
%>