A simple winform email sending program implemented in C # is as follows:
Drag Textbox, label, and button in the design interface. For details, see:
The code for clicking an event on the send button is as follows:
Private void btnsend_click (Object sender, eventargs E)
{
Smtpclient mailclient = new smtpclient ("mail.sina.com"); // SMTP server name;
Mailclient. Credentials = new networkcredential ("xxx@sina.com", "***"); // user name and password;
Mailaddress from = new mailaddress ("xxx@sina.com"); // sender address;
Mailaddress to = new mailaddress(this.txt mailto. Text );
Mailmessage message = new mailmessage (from, );
Message. Subject = this.txt subject. text;
Message. Body = This. rtxtcontent. text;
If (this.txt cc. Text. Trim ()! = "")
{
Mailaddress copy = new mailaddress(this.txt cc. Text. Trim ());
Message. CC. Add (copy );
}
Try
{
Mailclient. Send (Message );
MessageBox. Show (this, "prompt", "sent successfully! ", Messageboxbuttons. OK, messageboxicon. Information );}
Catch (exception ex)
{
Throw ex;
}
}
Reference to be added:
Using system;
Using system. Windows. forms;
Using system. net. mail;
Using system. net;
In this way, a simple email sending program is completed ~~~
Of course, you can modify the Group Sending and email template functions on this basis.
Currently, most free emails on the Internet do not provide free SMTP services. It is said that Sina still can do it... the code above can be sent through my company email test ~