943,808 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Marked Solved
  • Views: 2296
  • C# RSS
Nov 24th, 2008
0

Problem With Sending Email Through Asp.net

Expand Post »
I'm trying to sending Email through my web application from Gmail
by using Sustem.Net.Mail.SmtpClient
My code is
C# Syntax (Toggle Plain Text)
  1. string To = "doctor_ofvet@yahoo.com";
  2. string From = "doctorofvet@gmail.com";
  3. string Subject = "The Famous";
  4. string Body = "Hello World";
  5. SmtpClient Client = new SmtpClient();
  6. Client.Send(From, To, Subject, Body);

I put this code in the web.config file
C# Syntax (Toggle Plain Text)
  1. <system.net>
  2. <mailSettings>
  3. <smtp>
  4. <network host="smtp.gmail.com" port="465" userName="Gmail Username" password="Password"/>
  5. </smtp>
  6. </mailSettings>
  7. </system.net>

but it did not success
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
compovet is offline Offline
20 posts
since Apr 2008
Nov 24th, 2008
0

Re: Problem With Sending Email Through Asp.net

can any one help me please
Reputation Points: 10
Solved Threads: 0
Newbie Poster
compovet is offline Offline
20 posts
since Apr 2008
Nov 24th, 2008
0

Re: Problem With Sending Email Through Asp.net

Hi there,

Last time I mailed with C#-code, it happened like this:

MailMessage mailMessage;
SmtpClient client;

mailMessage = new MailMessage();
client = new SmtpClient("relay.skynet.be"); //your mail-out server
mailMessage.To.Add("...@hotmail.com");
mailMessage.Subject = "...";
client.Send(mailMessage);

This was not in a web application but just a C#.NET windows application. I hope this helps you.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
EastStreetEagle is offline Offline
5 posts
since Nov 2008
Nov 24th, 2008
0

Re: Problem With Sending Email Through Asp.net

debugging would show wether your mail settings are being picked up for your new smtpclient. If not, it maybe better to set them.
Reputation Points: 196
Solved Threads: 190
Posting Virtuoso
LizR is offline Offline
1,735 posts
since Aug 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: inequality method in C#
Next Thread in C# Forum Timeline: Temperature conversion class in C#





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC