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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting up ASP.net to send mail

Status
Not open for further replies.

bbos360

Programmer
Mar 25, 2003
30
RO
Hi,

Any help is much appreciated on this query,

ASP.NET has been installed on our server (which can send normal coldfusion mail etc) and we have been developing for over a year now no problem. However simple asp.net mail scripts do not work - no email is recieved, the same script uploaded to our hosting provider works fine. Is there some sort of setup one needs to do before being able to send mails;

Script: (obviously the to and from address as re filled in with valid addresses)

MailMessage mail = new MailMessage();
mail.To = ""
mail.From = ""
mail.BodyFormat = MailFormat.Html;
mail.Subject = "test";
mail.Body = "test body";
SmtpMail.Send(mail);

Thanks in advance
 
I am no expert on this, but the only problem I have had is whent the SMTP part of the server was disabled.
Otherwise, the code like yours worked OK.....

Hope this helps, but otherwise good luck.

Russell
 
Try setting the SmtpMail.SmtpServer property. This property must be set in VS.net 2003 but is allowed to be null in 2002 even though sometimes it causes e-mails not to be sent out.

Also, check the mail folder on the server to make sure that the e-mails are not being dropped.

-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
 
I can see the directory under inetpub:

Drop, Pickup etc

If i want to check that the SMTP is working how is this done - can i write a text file (test.txt for eg) and copy into pickup directory. If so what should the .txt file contain i.e to=xyz@company.com etc

Thanks
 
From: person@domain.com
To: diffperson@diffdomain.com
Subject: Some Subject

Message content. I believe the CrLf(line space) is required before the message content.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top