how to send emails in asp.net(without IIS throught smtp)
-
You don't need to configure IIS. The SmtpMail[^] class has a static property used to set the SMTP server to send mail through. You can also configure this in the web.config file in the mailSettings[^] element
No comment
hi thanks for the reply as per the link u gave i wrote this in my web.config file and in my code i wrote this: MailMessage msgMail = new MailMessage(); msgMail.To = txtEmail.Text; SqlCommand slistname = new SqlCommand("select * from list_builder where listid=" + selVal, conn); drSubGroups = slistname.ExecuteReader(); while (drSubGroups.Read()) { msgMail.Subject = drSubGroups["ListName"].ToString(); } SqlCommand sAccoutdet = new SqlCommand("select * from create_account where UserId=" + Session["UserId"].ToString(), conn); drSubGroups = sAccoutdet.ExecuteReader(); while (drSubGroups.Read()) { msgMail.From = drSubGroups["EmailId"].ToString(); } msgMail.Body = "Confirm your subscription"; SmtpMail.SmtpServer = "smtp.domain.com"; SmtpMail.Send(msgMail); but still not working can you plz help me... K.Gayathri
-
hi friends i need to send mails from an asp.net application using c# but my IIS is not configured in my laptop so how to send mails can anyone help me in this issue plz.. K.Gayathri
-
hi thanks for the reply as per the link u gave i wrote this in my web.config file and in my code i wrote this: MailMessage msgMail = new MailMessage(); msgMail.To = txtEmail.Text; SqlCommand slistname = new SqlCommand("select * from list_builder where listid=" + selVal, conn); drSubGroups = slistname.ExecuteReader(); while (drSubGroups.Read()) { msgMail.Subject = drSubGroups["ListName"].ToString(); } SqlCommand sAccoutdet = new SqlCommand("select * from create_account where UserId=" + Session["UserId"].ToString(), conn); drSubGroups = sAccoutdet.ExecuteReader(); while (drSubGroups.Read()) { msgMail.From = drSubGroups["EmailId"].ToString(); } msgMail.Body = "Confirm your subscription"; SmtpMail.SmtpServer = "smtp.domain.com"; SmtpMail.Send(msgMail); but still not working can you plz help me... K.Gayathri
You have to give a better explanation than "it doesn't work". One guess is you are using localhost as the smtp server and I doubt very much your local machine is an email server or configured as a relay. Format your code snippets when posting
No comment
-
Warez yo grandmar dizzapeered to?
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925
-
hi thanks for the reply my problem is i am not able to connect to the smtp server can anyone help me out my code is: in my web.config file i have: my asp.net c# code is MailMessage msgMail = new MailMessage(); msgMail.To = txtEmail.Text; SqlCommand slistname = new SqlCommand("select * from list_builder where listid=" + selVal, conn); drSubGroups = slistname.ExecuteReader(); while (drSubGroups.Read()) { msgMail.Subject = drSubGroups["ListName"].ToString(); } SqlCommand sAccoutdet = new SqlCommand("select * from create_account where UserId=" + Session["UserId"].ToString(), conn); drSubGroups = sAccoutdet.ExecuteReader(); while (drSubGroups.Read()) { msgMail.From = drSubGroups["EmailId"].ToString(); } msgMail.Body = "Confirm your subscription"; SmtpMail.SmtpServer = System.Configuration.ConfigurationManager.AppSettings["SMTPServer"]; SmtpMail.Send(msgMail); K.Gayathri
-
hi thanks for the reply my problem is i am not able to connect to the smtp server can anyone help me out my code is: in my web.config file i have: my asp.net c# code is MailMessage msgMail = new MailMessage(); msgMail.To = txtEmail.Text; SqlCommand slistname = new SqlCommand("select * from list_builder where listid=" + selVal, conn); drSubGroups = slistname.ExecuteReader(); while (drSubGroups.Read()) { msgMail.Subject = drSubGroups["ListName"].ToString(); } SqlCommand sAccoutdet = new SqlCommand("select * from create_account where UserId=" + Session["UserId"].ToString(), conn); drSubGroups = sAccoutdet.ExecuteReader(); while (drSubGroups.Read()) { msgMail.From = drSubGroups["EmailId"].ToString(); } msgMail.Body = "Confirm your subscription"; SmtpMail.SmtpServer = System.Configuration.ConfigurationManager.AppSettings["SMTPServer"]; SmtpMail.Send(msgMail); K.Gayathri
- Format your code snippets when posting 2) Don't repeat the question/reply in multiple places 3) I gave you the answer.
No comment
-
- Format your code snippets when posting 2) Don't repeat the question/reply in multiple places 3) I gave you the answer.
No comment
hi i am having my .net application running in my system and i need to send a mail (eg to test to my email id itself). so i am sending an email from my .net application to my email address hope u got my question now.. i am getting the error a smtp not connected... K.Gayathri
-
hi i am having my .net application running in my system and i need to send a mail (eg to test to my email id itself). so i am sending an email from my .net application to my email address hope u got my question now.. i am getting the error a smtp not connected... K.Gayathri
I get your question, I got it the first time. Yes, you have an email address. Good for you. However, your local machine is NOT an email server. ASP.NET and IIS don't just magically route emails around the world. You NEED an email server send an email. Do you get my response? Let me repeat. Your local machine, ie localhost, is NOT an email server.
No comment
-
I get your question, I got it the first time. Yes, you have an email address. Good for you. However, your local machine is NOT an email server. ASP.NET and IIS don't just magically route emails around the world. You NEED an email server send an email. Do you get my response? Let me repeat. Your local machine, ie localhost, is NOT an email server.
No comment
-
ya i got what u r saying for that only i am trying to use smtp to send mails (is it ok) so now tell me how to send emails..hope u would have got my code from my previous posting.. K.Gayathri
-
hi friends i need to send mails from an asp.net application using c# but my IIS is not configured in my laptop so how to send mails can anyone help me in this issue plz.. K.Gayathri