tags:

views:

36

answers:

3

I have this code to send email notification in my page.

MailAddress to = new MailAddress("[email protected]"); 
MailAddress from = new MailAddress("[email protected]"); 
MailMessage message = new MailMessage(from, to); 
message.Subject = "Error Occred in the application:"; 
message.Body = ex.Message; 
SmtpClient client = new SmtpClient("smtp.gmail.com", 587); 
client.EnableSsl = true; 
client.Credentials = new NetworkCredential("user", "password"); 

Is there any other way we have without giving credentials to send the message?

+2  A: 

Only on servers that allow anonymous sending, which Gmail doesn't.

Andrew Lewis
Hmm.. can I use my domain server for sending an email without any credentials? thanks
kumar
Here are instructions on allowing anonymous outbound mail on your Exchange virtual SMTP server: http://technet.microsoft.com/en-us/library/bb124305(EXCHG.65).aspx
Andrew Lewis
+2  A: 

There are some workarounds mentioned here

Kamyar
+2  A: 

If you have an open mail relay that doesn't require credentials, then you don't need to supply them.

Jason
Thanks Jason,suppose if I am using intranet application for my project..so shell i use my official EmailID without credentilas?Thanks
kumar