-XieDeQiChi-SMTP-YanZhengDeFaSongYouJianQuJian-2-ci9k0137.html
References: http://www.5iaspx.comRespondents: H1J2H7-wizard five level 5-20 02:06? .....answered by:Using System;Using System.Collections.Generic;Using System.Text;Using System.Net;Using System.Net.Mail;Using Dbmodel;
Namespace MailSender{public class Mailutil{Send #region e-mail
public bool SendMail (Mailinfo mailinfo){Try{/* Sender's information * *string smtp = Mailinfo.mailstmp; The server of the mailbox used by the senderstring
);_mailmessage.subjectencoding = System.Text.Encoding.GetEncoding ("gb2312");_mailmessage.subject = content;//Theme_mailmessage.body = body;//Content_mailmessage.bodyencoding = System.Text.Encoding.GetEncoding ("gb2312");//Body Code_mailmessage.isbodyhtml = true;//is set to HTML format_mailmessage.priority = mailpriority.high;//PriorityTry{_smtpclient.send (_mailmessage);}catch (Exception){}}Second, change the passwordCompare the parameters that were added to the data, and if the validation pass
C # implements a simple smtpclient send messageAnalysisWhat you needSend mail--Send content--Receive mailProcess (each function is applicable)creating objects-assigning values to object properties-calling methodsSend e-mailCreate a Mailbox server objectSenderRecipientCreate a Mail objectMessage subjectMessage contentSet up validation scenariosSet up a qualification certificateSendUsing System.Net; --Internet naming spaceUsing System.Net.Mail; --e-mail
messageMessage. from = Messagefrom;Message. To.add (Messageto); The recipient's mailbox address can be multiple to achieve massMessage. Subject = MessageSubject;Message. BODY = MessageBody;Message. Isbodyhtml = false; is HTML formatMessage. Priority = Mailpriority.high; Priority of sending messagesSmtpClient sc = new SmtpClient (); Simple Mail Transfer Protocol (easy message Transfer Protocol)Sc. Host = "smtp.qq.com"; Specifies that the address of th
Recently in the mail to send the interface to the problems encountered and solutions to tell you want to know the message to help people
The original program part of the code is as follows
Set mail message sender address, recipient address, title, subject
MailMessage mail = new MailMessage ("xxxxxxx@sina.com", "zzzzzzz@sina.com", "title", "Subject");
//Set mail subject format
. bodyencoding = Encoding.UTF8;
Sets whether the message body format is HTML format
mail. isbodyhtml = fal
This article gives you a detailed introduction of the following. NET SMTP send email with attachment to the specific implementation of ideas and code, want to realize the friend can refer to Ha, I hope to help you
copy code code as follows:
public static void SendEmail (String toaddress, string emailbody) { var fromaddress = configurationmanager.appsettings["EmailAddress"]; string frompassword = configurationmanager.appsettings["Emailpassword"]. ToString (); Const String Subject = "Job
a. NET to send an instance of a message with an attachment using SMTP
Copy Code code as follows:
public static void SendEmail (String toaddress, String emailbody)
{
var fromaddress = configurationmanager.appsettings["EmailAddress"];
String Frompassword = configurationmanager.appsettings["Emailpassword"]. ToString ();
Const string Subject = "Job Recommendation";
var smtp = new SmtpClient
{
Host = configurationmanager.appsettings["S
Using system. net. mail;Using system. Threading;
// ************************** Send an emailCode:System. net. Mail. smtpclient client = new smtpclient ();Client. Host = "smtp.qq.com ";Client. usedefacrecredentials = false;Client. Credentials = new system. net. networkcredential ("Account", "password ");// Use an asterisk to change the password of your mailboxClient. deliverymethod = smtpdeliverymethod. Ne
The first code can only send a message without SMTP authentication, but now a lot of email sent need to verify, and then look for the next MSDN Help, found the code to send the verification, posted out hope for everyone to help!
Copy Code code as follows:
public static int SendMail (string to, string body,string subject)
{
Try
{
int ncontain = 0;
Add Sender Address
String from = "Your send email";
MailMessage MAILMSG = new MailMessage ();
Mailmsg.from = new MailAddress (from)
Send mail
In the. NET Framework 1.x we need to use classes under the System.Web.Mail namespace to send mail, but the function is weak, such as your mail server needs to verify to send mail, in. NET 1.1, you need to use the following code for additional configuration.
Mail. Fields.Add ("Http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"Mail. Fields.Add ("Http://schemas.microsoft.com/cdo/configuration/sendusername"Mail. Fields.Add ("Http://schemas.microsoft.com/cdo/configuration/send
Problem System.Net.Mail SmtpClient to send the message, while System.Net.Mail only supports explicit SSLDo not 465 ports, with 25, without Enablessl = true;{static void Main (string[] args){SmtpClient client = new SmtpClient ();Client. Host = "smtp.exmail.qq.com";Client. Port = 25;Client. Port = 465;Client. Enablessl = true;Client. Timeout = 10000;Client. Deliver
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.