C # Connect Exchange send mail code as follows
<summary>///Exchange bulk mail///</summary>//<param name= "Credentialusername" > Exchange user name [example:test]</param>//<param name= "credentialuserpwd" >exchange user password </param> <param name= "Fromemail" > Sender Address [Example: [email protected]]</param>//<param name=] Reci Pientemail "> Recipient address </param>//<param name=" DomainName "> Mail domain name [EXAMPLE:MAIL.ALLBRING.COM]</PARAM&G T <param name= "Subjectname" > Email subject </param>//<param name= "bodyval" > Message content </param>// /<param name= "ishtml" > whether html</param>//<param name= "Filearray" > Send upload path </param>/ <returns></returns>//Developer: ZJ public static bool Sendexchangeemails (String Credentialuserna Me, String credentialuserpwd, String fromemail, list<string> recipientemail, String domainName, String subjectname , String Bodyval, bool ishtml, string[] filearray) {try {mailmessage message = new Mailmessa GE (); MailAddress fromaddress = new MailAddress (fromemail); foreach (string item in Recipientemail) {message. To.add (item); } message. from = fromaddress; Message. Subject = Subjectname; Message. Body = Bodyval; Message. isbodyhtml = ishtml; if (Filearray! = null) {for (int i = 0; i < filearray.length; i++) {//Create file attachment for message Attachment attr = new Attachment (Filearray[i], mediatypename S.application.octet); Add message timestamp information contentdisposition Condispositon = attr. Contentdisposition; Condispositon.creationdate = System.IO.File.GetCreationTime (Filearray[i]);//FileCreation Date Condispositon.modificationdate = System.IO.File.GetLastWriteTime (Filearray[i]);//Modified date of File Condispositon.readdate = System.IO.File.GetLastAccessTime (Filearray[i]);//Read date of File Add an attachment message to the message. Attachments.Add (attr); }} smtpclient SmtpClient = new SmtpClient (); Smtpclient.timeout = 50000; Smtpclient.host = DomainName; Smtpclient.port = 25; Smtpclient.usedefaultcredentials = false; Smtpclient.credentials = new System.Net.NetworkCredential (Credentialusername, credentialuserpwd); Smtpclient.enablessl = true; Smtpclient.deliverymethod = Smtpdeliverymethod.network; Smtpclient.send (message); Smtpclient.dispose (); return true; } catch (Exception) {return FALSe } }
Reference Address: https://social.technet.microsoft.com/Forums/en-US/d37c7e8a-6d42-498a-bad4-5eb0ab7e9d40/ Connecting-to-exchange-server-using-c-to-send-an-email?forum=exchangesvrdevelopment
Http://www.systemnetmail.com/faq/2.4.aspx
C # connect Exchange send mail