By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,143 Members | 1,254 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,143 IT Pros & Developers. It's quick & easy.

Mail not getting send.

P: n/a
Hi all,

i am having application in c# for sending mails.

I want to ask few question related to sending mail.

If address of smtp server is not set, then will the mails be send to
address specified in tomail field.

Is it neccessy to set smpt server address in mail message class.

Because in example given in msdn there is nothing done as such for
setting smpt server address.
Can someone tell me as this is very importany for me.

Any help will be truely apprecaited.

thanks in advance.

Nov 24 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi,

Check this article:

http://www.codeguru.com/columns/DotN...cle.php/c5467/

You must set the SmtpMail.SmtpServer property if the mail server is located
in a machine different than localhost.

Regards - Octavio

<tr**************@yahoo.com> escribió en el mensaje
news:11**********************@o13g2000cwo.googlegr oups.com...
Hi all,

i am having application in c# for sending mails.

I want to ask few question related to sending mail.

If address of smtp server is not set, then will the mails be send to
address specified in tomail field.

Is it neccessy to set smpt server address in mail message class.

Because in example given in msdn there is nothing done as such for
setting smpt server address.
Can someone tell me as this is very importany for me.

Any help will be truely apprecaited.

thanks in advance.

Nov 24 '05 #2

P: n/a
This works for me:
try
{
string machine = Environment.MachineName;
mail=new MailMessage();
mail.From = machine + "@mydomain.com";// OR any address
mail.To=strTo;
mail.Cc=strCC;
mail.Bcc=strBCC;
mail.Subject = strSubject;
mail.Body = strBody;
SmtpMail.SmtpServer="localhose";
// OR TRY "mail.mydomain.com";if you know it
// OR 1.1.1.127
SmtpMail.Send(mail);
}
catch(System.Web.HttpException ehttp){}

Since SmtpServer property is static, you should only have to set this
one in your app and not have to repete.

Hope this helps

Nov 24 '05 #3

P: n/a
This works for me:
try
{
string machine = Environment.MachineName;
mail=new MailMessage();
mail.From = machine + "@mydomain.com";// OR any address
mail.To=strTo;
mail.Cc=strCC;
mail.Bcc=strBCC;
mail.Subject = strSubject;
mail.Body = strBody;
SmtpMail.SmtpServer="localhose";
// OR TRY "mail.mydomain.com";if you know it
// OR 1.1.1.127
SmtpMail.Send(mail);
}
catch(System.Web.HttpException ehttp){}

Since SmtpServer property is static, you should only have to set this
one in your app and not have to repete.

Hope this helps

Nov 24 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.