how to send a email....
-
Hy, I have created a email page by using the following code MailMessage msg = new MailMessage(); msg.To = txtTo.Text; msg.From = txtFrom.Text; msg.Subject = txtSubject.Text; msg.Body = txtContent.Value; lblStatus.Text = "Sending..."; SmtpMail.Send(msg); but when i run the page the mail is not sent.... do i have to use SmtpMail.SmtpServer for sending the mail? plz help... regards
-
Hy, I have created a email page by using the following code MailMessage msg = new MailMessage(); msg.To = txtTo.Text; msg.From = txtFrom.Text; msg.Subject = txtSubject.Text; msg.Body = txtContent.Value; lblStatus.Text = "Sending..."; SmtpMail.Send(msg); but when i run the page the mail is not sent.... do i have to use SmtpMail.SmtpServer for sending the mail? plz help... regards
first of all you have to Configure your SMTP Server for sending mail.
raghvendrapanda wrote:
msg.To = txtTo.Text;
You can't do like this, because its take only type of
MailAddress
orMailAddressCollection
object. So usemsg.To=new MailAddress(TxtTo.Text)
For sending Mail
SmtpClient _smtServer=new SmtpClient("MyServer");
_smtServer.Send(msg);cheers, Abhijit
-
first of all you have to Configure your SMTP Server for sending mail.
raghvendrapanda wrote:
msg.To = txtTo.Text;
You can't do like this, because its take only type of
MailAddress
orMailAddressCollection
object. So usemsg.To=new MailAddress(TxtTo.Text)
For sending Mail
SmtpClient _smtServer=new SmtpClient("MyServer");
_smtServer.Send(msg);cheers, Abhijit
Hy, Thankz for replying to my querry..but can u tell me that how can i Configure my SMTP Server for sending mail.
-
Hy, Thankz for replying to my querry..but can u tell me that how can i Configure my SMTP Server for sending mail.
cheers, Abhijit
-
first of all you have to Configure your SMTP Server for sending mail.
raghvendrapanda wrote:
msg.To = txtTo.Text;
You can't do like this, because its take only type of
MailAddress
orMailAddressCollection
object. So usemsg.To=new MailAddress(TxtTo.Text)
For sending Mail
SmtpClient _smtServer=new SmtpClient("MyServer");
_smtServer.Send(msg);cheers, Abhijit
Hy, I configured the SMTP but it didnt help...I found a virtual directory where a default setting was present ..on tracking i found all my mail where stored in a folder(C:\Inetpub\mailroot\Queue)..and were not sent to the mail..what sholud i do in order to send them? you suggested me a code.. SmtpClient _smtServer = new SmtpClient("MyServer"); when i used this i get an exception that mail sending failed..
-
Hy, I configured the SMTP but it didnt help...I found a virtual directory where a default setting was present ..on tracking i found all my mail where stored in a folder(C:\Inetpub\mailroot\Queue)..and were not sent to the mail..what sholud i do in order to send them? you suggested me a code.. SmtpClient _smtServer = new SmtpClient("MyServer"); when i used this i get an exception that mail sending failed..
raghvendrapanda wrote:
SmtpClient _smtServer = new SmtpClient("MyServer");
Did you put your SMTP server name over "MyServer"
cheers, Abhijit
-
raghvendrapanda wrote:
SmtpClient _smtServer = new SmtpClient("MyServer");
Did you put your SMTP server name over "MyServer"
cheers, Abhijit
Hy, i changed Myserver to local host and de mail got stored in C:\Inetpub\mailroot\Queue.. i created a new remote domain and named it gmail.com ..And dn i added "RemoteServer" instead of MYSERVER .itz execution was sucessful..But again it went and got stored in.C:\Inetpub\mailroot\Queue.. (if i want to send my mail to gmail.com what should i do?)..Do i have to use sum other server for dis?or server permission is required?
-
Hy, I have created a email page by using the following code MailMessage msg = new MailMessage(); msg.To = txtTo.Text; msg.From = txtFrom.Text; msg.Subject = txtSubject.Text; msg.Body = txtContent.Value; lblStatus.Text = "Sending..."; SmtpMail.Send(msg); but when i run the page the mail is not sent.... do i have to use SmtpMail.SmtpServer for sending the mail? plz help... regards
Check your web.config file as far as my knowledge is concern we mention port number in web.config.
Shazz here to help you...