tags:

views:

126

answers:

3

am trying to send a mail from my localhost using c sharp using smtpclient class in the system.net!!having done everything a generl exception is thrown (mail not sent)??please help??is there any thing that might be wrong with my iis configuration?? i doubt!!any way help!!thanks in advance

+1  A: 

If you are sending the mail from IIS then by default you will be using the identity of the application pool, which is Network Service.

Network Service probably does not have the right to send a mail.

Make sure that the call to the mail server is done with the identity of a user that is allowed to send mail.

Shiraz Bhaiji
A: 

Have a look at this article as to how to setup IIS and to send email in c#.

http://www.c-sharpcorner.com/UploadFile/scottlysle/EmailAttachmentsCS08052008234321PM/EmailAttachmentsCS.aspx

David Liddle
A: 

At first I wanted to set my PC as SMTP-Server but I found out it's much easier to use GMAIL.

http://www.shabdar.org/send-email-using-gmail-account-asp-net-csharp.html

Faruz