In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "how to solve the problem of Jmail sending mail and garbled codes with attachments". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "how to solve the problem of Jmail sending email and garbled code with attachments"!
The specific use of Jamil to send mail:
First, we need to download the components of Jamil.dll, then add the reference using jmail, and then register it locally or on the server
Copy the jmail.dll to the server's system32 directory, start-run-cmd- type regsvr32 jmail.dll, register successfully, and then write the code
The code is as follows (method)
The copy code is as follows:
Using jmail
Protected void sendMail (String sender, String senderMail, String receiver, String subject, String content)
{
Jmail.MessageClass jmMessage = new jmail.MessageClass ()
/ / set character set
JmMessage.Charset = "gb2312"
/ / Sender email address
JmMessage.From = senderMail
/ / name of the sender
JmMessage.FromName = sender
/ / set the theme
JmMessage.Subject = subject
/ / set content
JmMessage.Body = content
/ / set recipient mailbox
JmMessage.AddRecipient (receiver, ",")
/ / set the user name and password of the login mailbox
JmMessage.MailServerUserName = "ss"
JmMessage.MailServerPassWord = "ss"
/ / set the smtp server address
If (jmMessage.Send ("smtp.163.com", false))
{
Response.Write ("alert (" sent successfully "))
}
Else
Response.Write ("alert ('www.jb51.net send failed')")
}
The above is the specific use of Jmail!
I would like to put an attachment as follows
The copy code is as follows:
Jmail.AddAttachment ("c:autoexec.bat")
Jmail.AddAttachment ("myImage.gif", TRUE)
The result is the following error
This is a multipart message in MIME format. -- NEXT_BM_AEB3968967D044DC9E208D04088C60B4 Content-Type: text/html; charset= "GB2312" Content-Transfer-Encoding: Quoted-Printable sdfdd-- NEXT_BM_AEB3968967D044DC9E208D04088C60B4 Content-Type: application/octet-stream; name= "? GB2312?Q?12d95384-576fmur424ff15 Content-Transfer-Encoding f8e2397e2791E2791EJPGboat =" Content-Transfer-Encoding: base64 Content-Description: =? GB2312?Q?12d95384-576fMU424fF15 Content-Disposition = Content-Disposition: inline; filename= "=? GB2312?Q?12d95384-576fmur424fff15f8e2397e2791EJPGboat =" Content-ID:
Found a solution online:
The copy code is as follows:
AddAttachment (FileName, isInline, ContentType):
String adds a file attachment to the message. If the Inline property is set to true, the attachment is an embeddable attachment, and the addAttachment () method returns content id, which is useful when sending HTML messages.
Example:
The copy code is as follows:
Jmail.AddAttachment ("c:autoexec.bat")
Jmail.AddAttachment ("myImage.gif", TRUE)
Embeddable attachment
2.AddURLAttachment (bstrURL, bstrAttachAs, isInline, bstrAuth): String downloads the file from the specified URL and adds it as an attachment. The second parameter "AttachAs" is used to change the file name of the file added as an attachment. If the Inline property is set to true, the attachment is an embeddable attachment. Use the ddAttachment () method to return content id, which is very useful when sending HTML messages. The last parameter is optional and is used when the server needs authentication.
Example
The copy code is as follows:
Jmail.AddURLAttachment ("w3jmail4.exe", "w3jmail4.exe")
Jmail.AddURLAttachment "w3jmail4.exe", "w3jmail4.exe", false, "myUserName:myPassword") jmail.AddURLAttachment "dimaclogo.gif", "dimaclogo.gif", true)
At this point, I believe you have a deeper understanding of "how to solve the problem of Jmail sending mail and garbled code with attachments". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.