Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > Visual Web Developer 2008
|
Visual Web Developer 2008 Discuss creating ASP.NET 3.5 sites with Microsoft's Visual Web Developer 2008. If your question is more specific to a piece of code than the Visual tool, see the ASP.NET 3.5 forums instead. If your question is specific to the "Express Edition" be sure to state that in your post.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Web Developer 2008 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 16th, 2009, 08:43 PM
Authorized User
 
Join Date: Dec 2009
Posts: 30
Thanks: 2
Thanked 0 Times in 0 Posts
Send a message via Yahoo to kirangentlebreeze1987
Default email

when i try to send mail an exception was raised "mail box unavailable" this is my code protected
void CreateUserWizard1_CreatedUser(object sender, EventArgs e) {
MembershipUser newuser = Membership.GetUser(CreateUserWizard1.UserName);
Guid newuserid = (Guid)newuser.ProviderUserKey;
SqlConnection con = new SqlConnection("Data Source=KIRAN\\SQLEXPRESS;Initial Catalog=kiran;Integrated Security=True"); con.Open(); string querystring; querystring = "insert into reg(username,password,email,securityquestion,secur ityanswer,userid)values(@username,@password,@email ,@securityquestion,@securityanswer,@userid)"; SqlCommand cmd = new SqlCommand(querystring, con);
SqlParameter uname = new SqlParameter("@UserName", SqlDbType.NVarChar, 50);
uname.Value = CreateUserWizard1.UserName;
cmd.Parameters.Add(uname);
SqlParameter pass = new SqlParameter("@Password", SqlDbType.NVarChar, 50);
pass.Value = CreateUserWizard1.Password;
cmd.Parameters.Add(pass); SqlParameter ema = new SqlParameter("@Email", SqlDbType.NVarChar, 50);
ema.Value = CreateUserWizard1.Email;
cmd.Parameters.Add(ema);
SqlParameter secques = new SqlParameter("@securityanswer", SqlDbType.NVarChar, 50);
secques.Value = CreateUserWizard1.Question;
cmd.Parameters.Add(secques);
SqlParameter secans = new SqlParameter("@securityquestion", SqlDbType.NVarChar, 50);
secans.Value = CreateUserWizard1.Answer;
cmd.Parameters.Add(secans);
SqlParameter uid = new SqlParameter("@userid", SqlDbType.NVarChar, 50); uid.Value = newuserid.ToString();
cmd.Parameters.Add(uid); cmd.ExecuteNonQuery();
con.Close();
kiransendmail obj = new kiransendmail();
obj.SendMail(CreateUserWizard1.UserName, CreateUserWizard1.Password, CreateUserWizard1.Email); }
public class kiransendmail
{
System.Net.Mail.SmtpClient smtpConnection;
public kiransendmail()
{
smtpConnection = new System.Net.Mail.SmtpClient();
smtpConnection.Host = "kiran";//Your mail server's ip or name. smtpConnection.Port = 25;//The port
smtpConnection.Credentials = new System.Net.NetworkCredential("kiran", "kumar");//Username and password to access mail server }
public void SendMail(string Username, string password, string email)
{
string mailbody = String.Format("This is your account details. Username: {0}, Password: {1}", Username, password);
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
message.To.Add(email);
message.Subject = "Your account details";
message.From = new System.Net.Mail.MailAddress("kirangentlebreeze1987 @gmail.com");//Give your from e mail address here message.Body = mailbody;
smtpConnection.Send(message);
}
}
}
and my to add is [email protected] i am using default smtp server on iis
 
Old December 17th, 2009, 03:14 AM
Authorized User
 
Join Date: Dec 2009
Posts: 30
Thanks: 2
Thanked 0 Times in 0 Posts
Send a message via Yahoo to kirangentlebreeze1987
Default email

thank you very much sir,your help is appreciated......i completed that task of sending email sucessfully





Similar Threads
Thread Thread Starter Forum Replies Last Post
Conformation of email varunbwj BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 October 8th, 2009 07:35 AM
Edit User Profile - email garydarling BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 7 September 29th, 2006 06:58 AM
Conformation Screen. rupen Classic ASP Basics 3 July 12th, 2005 11:31 PM
how do i create email alis system in asp kale_tushar Classic ASP Basics 3 March 22nd, 2004 11:33 AM
how to create an email id through php script manu_mcs Pro PHP 0 December 8th, 2003 03:33 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.