How do i authenticate to send an email

zhaozj2021-02-16  52

System.Web.mail FAQ

Complete FAQ LISTING

3 Advanced Programing Samples

3.1 How do I send NON US-ASCII EMAILS? 3.2 HOW Do I EMBED IMAGES IN EMAIL? 3.4 How do I Email A Website Exception 3.5 How do I Encrypt Messages Using S / MIME OR PGP 3.6 How do I send multipart / limited emails? 3.7 How do I send multipart / alternative emails? 3.8 How do i authenticate to send an email? * You are here * [scroll to answer] [discuss]

3.8 How do i authenticate to send an email? Printer Friendly Email this FAQ Discuss

If you are using the .NET Framework 1.0, this Cannot Be Done. However, in The 1.1 Version, The MailMessage.fields Property Was Added. This allowed access to the underlying cdo.Message Fields.

The Following Example Demonstrates Sending Your UserName and Password To The SMTP Server To Provide Authentication.

[C #]

Private void page_load (object sender, system.eventargs e) {mailmessage mail = new mailmessage (); mail.to = "me@mycompany.com"; mail.from = "@Yourcompany.com"; mail.subject = " This Is A Test Email. "; mail.body =" some text goes "; mail.fields.add (" http://schemas.microsoft.com/cdo/configuration/smtpauthenticate, "1"); // Basic Authentication Mail.fields.add ("http://schemas.microsoft.com/cdo/configuration/sendusername", "My_USERNAME_HERE"); // set your username here mail.fields.add ("http: // Schemas. Microsoft.com/cdo/configuration/sendpassword "," super_secret "); // set your password here smtpmail.smtpserver =" mail.mycompany.com "; // Your real server goes here smtpmail.send (mail);}

转载请注明原文地址:https://www.9cbs.com/read-15188.html

New Post(0)