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

Sending Mail Using .NET

Status
Not open for further replies.

nikhilparchure

Programmer
Oct 6, 2001
121
AU
Hi ,
I have scanning thru on topics of sending mails using
.NET. I have tried the below code for sending mails .
This issue is that mails cannot be sent.

Dim mail As New MailMessage()
mail.To = "tovalidmail@mail.com"
mail.From = "fromvalidmail@mail.com"
mail.BodyFormat = MailFormat.Text
mail.Subject = "Subject of this Email"
mail.Body = "Body of this message."
SmtpMail.SmtpServer = "localhost"

SmtpMail.Send(mail)

-----------------------------
Also no error is displayed but mail is nor sent

Query
1) This code is run on my home PC Win2k server
would the above code be able to send mails using the
local SMTP server on my machine Or does it require
a dedicated Exchange Server setup.


Regards
Parchure Nihkil.
 
You can try the following: open the IIS console, right-click on "Default SMTP Virtual Server" and select "Properties". In "Access" tab, click on "Relay" button. In "Relay Restrictions" dialog, make sure that the "Only the list below" option is checked. Hit the "Add" button and enter the IP of local host:127.0.0.1, then hit "OK" to close both windows. See if this helps.
 
Be advised that the .NET SMTP classes are a wrapper around the old CDO COM object. If you use them, you'll need CDO installed too.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Thanks Guys ,
I have tried these combinations already , but am not able to send mails. Is there something special then the above settings needed to send .NET mails.
Thanks anyways would look further into this issue.

Regards
Parchure Nikhil

 
Have you checked in the C:\InetPub\MailRoot directory subfolders to see if you message appears in any of them. Maybe its getting stashed away somewhere and not actually sent?

Rob

Go placidly amidst the noise and haste, and remember what peace there may be in silence - Erhmann 1927
 
Hei ... I'm having similar problem.. i tried this also and in the
c:\inetpub\mailroot\Queue folder I see all the emails I'm sending thru my app being queued here ..... how can I get it to be actually sent to the destination automatically from my app?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top