| Home » Categories » Multiple Categories |
Sample Code to Send email using ASP.NET1.1 |
|
Article Number: 83 | Rating: Unrated | Last Updated: Tue, May 1, 2012 at 11:11 PM
|
Our mail server is configured with SMTP authentication and all your code need to use SMTP Authentication before you can send email. If your code does not use SMTP authentication, the email will not be sent.
private void Page_Load(object sender, System.EventArgs e)
{
MailMessage mail = new MailMessage();
mail.To = "[email protected]";
mail.From = "[email protected]";
mail.Subject = "this is a test email.";
mail.Body = "Some text goes here";
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 = "localhost"; //your real server goes here
SmtpMail.Send( mail );
}
|
Attachments
There are no attachments for this article.
|
I get an error Server.CreateObject Failed when I try to use CDONTs. What can I do?
Viewed 3566 times since Tue, May 1, 2012
Do you support ASP.NET MVC 6?
Viewed 5657 times since Wed, Feb 17, 2016
Issue with Storing Session
Viewed 4449 times since Tue, Mar 24, 2015
How do I query MySQL database in ASP.NET?
Viewed 13301 times since Tue, May 1, 2012
Sample Code to Send email using ASP.NET 2
Viewed 10363 times since Tue, May 1, 2012
My application pool stops working. What is wrong with my site?
Viewed 14015 times since Sun, Feb 15, 2015
Domain Name Server (DNS) Amplification Attack
Viewed 10182 times since Wed, Oct 15, 2014
Do you allow custom COM components?
Viewed 3541 times since Tue, May 1, 2012
Why do I suddenly receive the error message: "Compiler Error Message: The compiler failed with error code XXXXXXXXX"?
Viewed 21126 times since Wed, Feb 17, 2016
How do I redirect a subdomain to a subdirectory?
Viewed 4760 times since Tue, May 1, 2012
|
