| 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.
|
How can I enable ASP.NET 3.5 on your Control Panel?
Viewed 4280 times since Wed, May 2, 2012
Why do I suddenly receive the error message: "Compiler Error Message: The compiler failed with error code XXXXXXXXX"?
Viewed 18175 times since Wed, Feb 17, 2016
I cannot see my website. What should I do?
Viewed 4232 times since Thu, May 3, 2012
How to Solve an Error Message "Validation of viewstate MAC failed"
Viewed 10124 times since Tue, Apr 2, 2013
I get an error Server.CreateObject Failed when I try to use CDONTs. What can I do?
Viewed 3334 times since Tue, May 1, 2012
How do I redirect a subdomain to a subdirectory?
Viewed 4521 times since Tue, May 1, 2012
My site is showing 500 Internal Server error message. What is wrong here?
Viewed 4231 times since Thu, May 3, 2012
Domain Name Server (DNS) Amplification Attack
Viewed 9924 times since Wed, Oct 15, 2014
How to Solve the error: "405 - HTTP verb used to access this page is not allowed"?
Viewed 5888 times since Wed, Oct 24, 2018
How to solve ReportViewer error message: "An error has occurred during report processing. Input string was not in a correct format"
Viewed 8659 times since Tue, Jun 18, 2013
|
