Eamil sending

Closed
Agarwal - Jan 14, 2009 at 03:14 AM
imation
Posts
27
Registration date
Tuesday August 26, 2008
Status
Member
Last seen
May 16, 2009
- Jan 14, 2009 at 04:58 AM
Hello,
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Please Wait Connect to the server");
try
{
CDO.Message oMsg = new CDO.Message();
CDO.Configuration iConfg = new CDO.Configuration();
ADODB.Fields oFields;
ADODB.Field oField;

oFields = iConfg.Fields;

// Set Proxy properties
oField = oFields["http://schemas.microsoft.com/cdo/configuration/urlproxyserver"];
oField.Value = "151.20.10.111";

oField = oFields["http://schemas.microsoft.com/cdo/configuration/proxyserverport"];
oField.Value = 808;

oField = oFields["http://schemas.microsoft.com/cdo/configuration/smtpserver"];
oField.Value = "smtp.gmail.com";

oField = oFields["http://schemas.microsoft.com/cdo/configuration/smtpserverport"];
oField.Value = 465;

oField = oFields["http://schemas.microsoft.com/cdo/configuration/sendusing"];
oField.Value = 2;

oField = oFields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"];
oField.Value = 1;

oField = oFields["http://schemas.microsoft.com/cdo/configuration/sendusername"];
oField.Value = "yourusername@gmail.com";

oField = oFields["http://schemas.microsoft.com/cdo/configuration/sendpassword"];
oField.Value = "password";

oField = oFields["http://schemas.microsoft.com/cdo/configuration/smtpusessl"];
oField.Value = "true";

oFields.Update();

oMsg.Configuration = iConfg;

// Set common properties for Message
oMsg.Subject = "Test SMTP";
oMsg.From = "sachinkumar75@gmail.com";
oMsg.To = "umo.software@hcl.in";

oMsg.Send();
Console.WriteLine("Mail Send");
Console.ReadLine();
}
catch (Exception e)
{
Console.WriteLine(e.Message);
Console.ReadLine();
}
return;


}
}
}

this code show error "Transportation faild connect to the server"
HAlp me

1 reply

imation
Posts
27
Registration date
Tuesday August 26, 2008
Status
Member
Last seen
May 16, 2009
4
Jan 14, 2009 at 04:58 AM
0