Stmp sending mail is handled as a workaround for junk mail

Source: Internet
Author: User
Tags mailmessage smtpclient microsoft outlook

It was used yesterday. NET sent a message through SMTP sent a mail to their QQ mailbox, but after the successful delivery did not prompt the mailbox to receive new messages, and to the inbox there is no new mail.

This makes me feel strange, so I think it is as spam filtering, so click on the garbage box to see, if so, QQ mailbox filter, as spam processing.

So immediately on the internet to find a bit, finally found a way.

The problem lies in:

The other Mailbox server judgment: For the unknown software sent mail, the mailbox server may be considered spam, directly filter it out, this is the recipient of the Mail filter conditions, we can not change the fact.

Workaround:

1. Send the System.Net.Mail class to use the custom validation mechanism. Do not send with the System.Web.Mail class, usually the latter will be sent as spam, which is related to the authentication mechanism.

2. To declare the mail address and header information (MSG. Headers.add ("X-mailer", "Microsoft Outlook Express 6.00.2900.2869"); Draped in Outlook's waistcoat)

3. In particular, it is possible that some servers will be treated as junk mailboxes after you have already put on a legitimate vest, such as NetEase, because your email content may have some, sensitive words, or illegal information.

Code to send the message:

<summary>//e-mail///</summary>/<param name= "Subject" > Themes </param>//<param Name= "Body" > Email content </param>//<param name= "to" > email </param>///<param Name= "Mailfrom" > Sender </param>//<param name= "Mailfromname" > Mail display sender's name </param>//<param name= "MailDomain" > Server ground Address </param>//<param name= "Mailserverusername" > Username and password </param>//<param name= "Mailserverpasswo  Rd > Passwords </param>//<returns></returns> public bool Send (string Subject, String Body, String to,         String Mailfrom, String mailfromname, String MailDomain, String mailserverusername, String Mailserverpassword) {            try {mailmessage msg = new MailMessage (); Msg.            from = new MailAddress (Mailfrom, mailfromname); Msg. To.add (New MailAddress (to)); Msg.            Subject = Subject; Msg.            BODY = body; Msg.         Isbodyhtml = true;   Msg.            priority = Mailpriority.normal; Msg.            subjectencoding = System.Text.Encoding.UTF8; Msg.                        bodyencoding = System.Text.Encoding.UTF8; --begin msg, the key code that is not considered a spam message.            Headers.add ("X-priority", "3"); Msg.            Headers.add ("X-msmail-priority", "Normal"); Msg.   Headers.add ("X-mailer", "Microsoft Outlook Express 6.00.2900.2869"); This article sends messages on behalf of Outlook and is not treated as spam msg.            Headers.add ("X-mimeole", "produced by Microsoft MimeOLE V6.00.2900.2869"); Msg.            Headers.add ("Returnreceipt", "1");            Key code that is not considered spam--end smtpclient client = new SmtpClient (MailDomain); Client.            useDefaultCredentials = false; Client. Credentials = new NetworkCredential (Mailserverusername, Mailserverpassword); Account password client. Deliverymethod = smtpdeliverymethod.network;client.            Send (msg);        return true;    } catch {return false;} }

And then try to send an email to QQ mailbox, to 126 mailboxes can be received.

Stmp sending mail is handled as a workaround for junk mail

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.