Joke Collection Website - Blessing messages - ASP.net, a short message gateway, development help.

ASP.net, a short message gateway, development help.

This needs to be paid and free. At present, there is a simple and free way, that is, you can use the mail arrival notification function of mobile 139 mailbox to notify your mobile phone. It seems that other mail providers are starting to offer this service now. Specifically, you need to download the website information of all email providers.

The question now is how to send the mail to your mailbox when the page goes wrong.

Here is a box for you, and then I will make my own account information.

Public bool SendMail (string addition, string theme, string content)

{

attempt

{

SMTP client c = new SMTP client(" SMTP . 139 . com ",23); //You need to change the SMTP server address and the mail port of your mail server here, which can be found on the website.

C credentials = new network credential ("test001","password001"); //Enter the remitter's account number and password here.

//Define a message

mail message mail message = new mail message();

Mail message. from = new mail address(" XXXX @ 139 . com "); //Your 139 email address

Mail message. to . Add(toAdd); //Change this to the email address where you want to receive the error, and call this code when there is a system error.

Mail message. Subject = subject; //"System error reminder";

Mail message. Text = content; //"The system encountered an error for the following reasons:";

Mail message. Priority = mail priority. High;

Mail message. IsBodyHtml = true

Mail message. BodyEncoding = encoding. UTF8

//Send

C. send (mail message);

Mail message. dispose();

Return true

}

Catch (anomaly)

{

Returns false

}

}

In addition, the following namespaces need to be introduced

Use the system. Net . Mail

Use System.Net;

//Call example

SendMail("XXXX@ 139.com ","System error reminder ","Fill in the error reason here. " ); Here, change it to your own as needed. The first is the wrong mailbox, the second is the title, and the third is the content.