Sponsored By
MindStick Cleaner
Advertise with Us
Advertisement
Advertise with Us
Follow Us
Follow _MindStick_ on Twitter View MindStick Software's LinkedIn profile View MindStick Software's Facebook profile
Mindstick
Article Article  Forum Forum  Blog Blog  Quiz Quiz  Beginner Beginner  Careers Careers  Contact Contact  Login Login  
Home | Product | Services | About Us | Interview | DeveloperSection | Submit an Article | Submit Blog
Report Abuse Form
Reason:    
   

Home >> .Net >> ASP.Net >> About Sending an Email after registration
Author Post

Andrew Watson


Total Post: 6
Member Since: 12/21/2010
Points: 30
About Sending an Email after registration
Posted On: 2/17/2011 4:46:38 AM
Hi,
I want a code to send an email, to a user after registration. That email will contain some images and a link back url for an account confirmation.
Please provide me sample of code.

Thanks,
Andrew
Author Post

Uttam Misra


Total Post: 113
Member Since: 6/2/2010
Points: 818
Re: About Sending an Email after registration
Posted On: 2/17/2011 5:03:21 AM
check this code...I hope this will help you..

using System.Web.Mail;

try

            {

                string smtpServer = "relay-hosting.secureserver.net";

                string userName = "contact@yourdomain.com";

                int cdoBasic = 1;

                int cdoSendUsingPort = 2;

                MailMessage msg = new MailMessage();

                if (userName.Length > 0)

                {

                    msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver", smtpServer);

                    msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", 25);

                    msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", cdoSendUsingPort);

                    msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", cdoBasic);

                    //msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", userName);

                    // msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", password);

                }

                msg.To = "contact@yourdomain.com";

                msg.From = "contact@yourdomain.com";

                msg.BodyFormat = MailFormat.Html;

                msg.Subject = txtSubject.Text;          

                msg.Body = "Name: " + txtName.Text + "<br /><br />Company: " + txtCompany.Text + "<br /><br />Email: " + txtEmail.Text + "<br />" + txtDetails.Text;

                SmtpMail.SmtpServer = smtpServer;

                SmtpMail.Send(msg);

 

                msg.To = txtEmail.Text.Trim();

                msg.From = "donotreply@yourdomain.com";

                msg.BodyFormat = MailFormat.Html;

                msg.Subject = txtSubject.Text;

                msg.Body = @"Hi,<br/>

                Thanks for contacting , we will review your information and try to get back to you ASAP.<br/>

                Thanks;

 

                SmtpMail.SmtpServer = smtpServer;

                SmtpMail.Send(msg);

                ValidationSummary1.Visible = false;

                lblStatus.Visible = true;

                lblStatus.Text = "Message Sent Sucessfully.";

 

            }

            catch

            {

 

cheers


Author Post

Uttam Misra


Total Post: 113
Member Since: 6/2/2010
Points: 818
Re: About Sending an Email after registration
Posted On: 2/17/2011 5:04:04 AM
Modified On: 2/17/2011 5:04:33 AM
Report Abuse Form
Reason:    
 
Total Online Users: 7460
Advertisement
MindStick DataConverter
Advertise with Us
  
Copyright © 2009 - 2013MindStick. All Rights Reserved.