. NET error when sending mail using 163SMTP: The mailbox is not available. has no permission solution

Source: Internet
Author: User

C # implements Simple mail sending code as follows

         Public Static voidSendAsync (stringEmailto,stringSubjectstringmailbody) {            varmsg =NewMailMessage (); Msg.            To.add (Emailto); //Msg. from =NewMailAddress (_usernameforemail,"Sender name displayed", System.Text.Encoding.UTF8); Msg. Subject= subject;//message HeaderMsg. Subjectencoding =System.Text.Encoding.UTF8; Msg. Body= Mailbody;//Message ContentMsg. Bodyencoding =System.Text.Encoding.UTF8; Msg. Isbodyhtml=false; Msg. Priority= Mailpriority.high;//Message Priority//            varClient =NewSmtpClient (); Client. useDefaultCredentials=false; Client. Credentials=NewNetworkCredential (_usernameforemail, _passwordforemail); //Client. Host =_smtphost; Try            {                //simply a little bit can be client. Send (msg); client.                Send (msg); //Task.Factory.StartNew (() =//{                //client.                Send (msg); //}); //client. SendAsync (msg, userState);                            }            Catch(Smtpexception ex) {
Log. Error (ex); Throwex; } }

When you pass in the correct user name and password for the sending mailbox, you always receive: The mailbox is unavailable. has no permission such error, English error: Mailbox unavailable. The server response Was:user has no permission.

Actually, we use. NET sends a message when the custom client logs in based on the user name and password, and then uses the SMTP service to send the message. However, the newly registered 163 messages are not turned on by default for Client authorization verification (default on for custom mailbox master clients),

Therefore the login is always rejected, and authentication does not have permissions. The solution is to enter 163 mailbox, enter the mailbox center-the client authorization password, choose to open, as follows

After the setup is complete, use the client authorization password in your code instead of the original mailbox password, so that you can send the message correctly.

. NET error when sending mail using 163SMTP: The mailbox is not available. has no permission solution

Related Article

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.