Hi Imar,
I'm currently in the excercise how to send email from ur web page.
The Specifiedpickupdirectory is working fine bt sending from mail to mail not working as it says timeout expired.
As i've already searched the forums and couldn't able to get a solution. Another guy is also having the same problem as i in which he also needs solution. But he's having a different error. so please help me to get a solution.
Here's my code
Code:
Email.aspx.cs
-------------
protected void Page_Load(object sender, EventArgs e)
{
MailMessage myMessage = new MailMessage();
myMessage.Subject = "Text Message";
myMessage.Body = "Hello World, Welcome To Planet Wrox";
myMessage.From = new MailAddress("my@gmail.com", "Developer");
myMessage.To.Add(new MailAddress("my@gmail.com", "Developer"));
SmtpClient mySmtpClient = new SmtpClient();
mySmtpClient.Send(myMessage);
}
Web.config
-----------
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<pages theme ="Monochrome">
<controls>
<add tagName="Banner" tagPrefix="Wrox" src ="~/Controls/Banner.ascx"/>
</controls>
</pages>
</system.web>
<system.net>
<mailSettings>
<!--<smtp deliveryMethod ="SpecifiedPickupDirectory">
<specifiedPickupDirectory pickupDirectoryLocation ="c:\TempMail" />-->
<smtp deliveryMethod="Network" from="my@gmail.com">
<network enableSsl ="true" userName="myname" password="mypass" host="smtp.gmail.com" port="465"/>
</smtp>
</mailSettings>
</system.net>
</configuration>