Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question on SMTP mail.

Status
Not open for further replies.

whloo

Programmer
Apr 14, 2003
168
SG
Hi,

I am using smtp to send mail.
Wish to understand more how actually the smtp server work.

I use the below code to send mail without specifying the smtp server name and it works perfectly find.
It will auto detect my smtp server i presume....

public void sendMail(string xTo,string xCC,string xBCC,string xSubject,MailPriority xPriority,string xBody)
{
MailMessage xMailMessage = new MailMessage();
xMailMessage.From = xFrom;
xMailMessage.To = xTo;
xMailMessage.Cc = xCC;
xMailMessage.Bcc = xBCC;
xMailMessage.Subject = xSubject;
xMailMessage.Priority = xPriority;
xMailMessage.Body = xBody;

SmtpMail.Send(xMailMessage);
}

Then when i bring all my code to my home, surprisingly it able to send mail also using my application.
Now i wonder if the smtp is using my isp smtp server?
if anyone have better idea on how the SmtpMail work, please contribute as i wish to know more about how it actually work.
Thanks!

regards,
weihann.
 
you can specify your smtp server using the smtp class property (before you send the mail obviously):

System.Web.Mail.SmtpMail.SmtpServer = "smtp.yourserver.com"

you should specify the server you are using before you send mail. i do not know how it would automatically resolve your smtp server however.

joel konecny
global110.com
 
hi hotwu,

i didn't specify it currently and i am pretty like the auto detect smtp server part.
just curious how it actually working.
 
this is just a guess, but perhaps your local computer has already registered default smtp servers to use with current e-mail applications. the .net framework may be able to detect these currently installed smtp services... or perhaps it is detecting ms smtp service running on your computer (if it is) ~ i know that this is definitely possible.

these are just a couple ideas, if i see anything online concerning this i will let you know.

joel konecny
global110.com
 
thanks hotwu,

i will post also if i ever find the answer for it :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top