Click here to Skip to main content
15,902,198 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C#
MailMessage msg = new MailMessage();
msg.To = txtto.Text;
msg.From = "swarupa.ummalaneni@gmail.com";
msg.Subject = txtsubject .Text;
msg.Body = Output.InnerHtml;

lblmessage.Text = "Sending...";
SmtpMail.SmtpServer = "smtp.yourISP.com";
SmtpMail.Send(msg);
lblmessage.Text = "Sent email (" + txtsubject.Text + ") to " + txtto.Text;

In above code SmtpMail.SmtpServer = "smtp.yourISP.com"; in place of "smtp.yourISP.com" what should I write here? Can anybody help me?
Posted
Updated 25-Jan-11 1:30am
v2

You need the name of your smtp server. It's usually in the form "smtp.yourispname.com", like "smtp.sbcglobal.net", or "smtp.roadrunner.com". You can get this info from your ISP's email help web page.
 
Share this answer
 
Comments
Christian Graus 25-Jan-11 7:44am    
Wow - I am more grumpy than you. Is that an achievement ?
#realJSOP 25-Jan-11 12:25pm    
I think you've been grumpier than me for a long time. :)
Hi
You have to put your host name or IP Address of server from where message are allow to fire.
for example if you are using the gmail smtp server then you can use

SmtpMail.SmtpServer="smtp.gmail.com"

Still if you have any query let me know.

Thanks,
 
Share this answer
 
Wow. If you don't know how to set up a mail server, why are you writing code. We can't answer this, because the answer is, your smtp server, as it says. Perhaps you should do a course instead of copying random code off the web ?
 
Share this answer
 
Try the following settings.

SmtpServer ="smtp.gmail.com"
port="587"
userName="<<your username on gmail>>"
password="<<your password>>"
enableSsl="true"
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900