JMail send mail and with accessory garbled solution sharing

Source: Internet
Author: User
Tags character set mail net send

  This article mainly introduces the JMail send mail and with the attachment of garbled solution, the need for friends can refer to the

Jamil the specific use of sending mail:   First, we will first download the Jamil.dll component, and then add a reference using JMail, and then on the local or server register   Copy Jmail.dll to the server's System32 directory, start-run-cmd-input regsvr32 jmail.dll, register successfully, then write code   code as follows: using JMail;     protected void SendMail (string sender, String sendermail, string receiver, string subject, string content) & nbsp   {          JMail. MessageClass jmmessage = new JMail. MessageClass ();          //Set character set           Jmmessage.charset = "gb2312";          //Senders email address           jmmessage.from = Sendermail;          //Sender name           jmmessage.fromname = sender;          //Set theme           jmmessage.subject = Subject;          //setting contents           jmmessage.body = content;          //Set recipient mailbox           jmmessage.addrecipient (receiver, "", "");          //Setting up login username and password           Jmmessage.mailserverusername = "ss" ;           Jmmessage.mailserverpassword = "ss";          //Set SMTP server address           if (Jmmessage.send ("smtp.163.com", FAL SE)         {              Response.Write ("<script>alert Send Success ') </script> ");           {          else             &NB Sp Response.Write ("<script>alert (' www.jb51.net send failure ') </script>");      }       above is the specific usage of JMail!   I would like to put an attachment to the following   code as follows: JMail. AddAttachment ("C:autoexec.bat")   JMail. AddAttachment ("Myimage.gif", TRUE)       The results are as follows:   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-576f-424f-bf15-f8e2397e2791=2ejpg?= "content-transfer-encoding:base64 Content-Description: =? GB2312? Q?12d95384-576f-424f-bf15-f8e2397e2791=2ejpg?= Content-disposition:inline; Filename= "=? GB2312? Q?12d95384-576f-424f-bf15-f8e2397e2791=2ejpg?= "Content-id:   Online found a solution:     Code as follows: AddAttachment ( FileName, IsInline, ContentType):     string Adds a file-type attachment to the message. If the inline property is set to True, this attachment is an embeddable attachment, and using the AddAttachment () method returns the content ID, which is useful when sending an HTML message.   Example:       Code is as follows: JMail. AddAttachment ("C:autoexec.bat")   JMail. AddAttachment ("Myimage.gif", TRUE)     embeddable attachments   2.AddURLAttachment (bstrURL, Bstrattachas, IsInline, Bstrauth): String downloads the file from the specified URL and adds it as an attachment. The second argument "Attachas" is used to change the file name of the file added as an attachment, and if the inline property is set to True, thisAn attachment is an embeddable attachment that uses the Ddattachment () method to return the content ID, which is useful when sending an HTML message. The last parameter is optional and is used when the server requires authentication.   Example       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)       measured, as if it had nothing to do with two methods. Later on the internet, someone said the Message.contenttype = "text/html" Settings to remove (is not to set the ContentType property), tried, and really sent a successful  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.