Gmail as SMTP

Experiences, small talk, and other automation gossip.
skhanpara
Posts: 94
Joined: Wed Apr 23, 2014 3:55 pm

Gmail as SMTP

Post by skhanpara » Fri May 02, 2014 9:27 pm

Can i use Gmail As SMTP?

I'm using Host as "smtp.gmailo.com";
port = 465;

but not result

I download CustomLogger from Ranorex website.

skhanpara
Posts: 94
Joined: Wed Apr 23, 2014 3:55 pm

Re: Gmail as SMTP

Post by skhanpara » Mon May 05, 2014 3:02 pm

I'm using this code to send mail


try
{
SmtpClient smtpClient = new SmtpClient();
smtpClient.Host = "smtp.gmail.com";
smtpClient.Port = 465;
smtpClient.Credentials = new NetworkCredential("My Email", "Mypassword");
smtpClient.EnableSsl = true;
smtpClient.Send(mail);
}
catch (Exception ex)
{
Console.Write(ex);
}
}

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Gmail as SMTP

Post by Support Team » Wed May 07, 2014 3:24 pm

Hello skhanpara,

Unfortunately we are not able to analyze what is causing your issue due to the lack of information.
May I ask you to provide your implemented custom logger class as well as the initialization of the class (which is usually done in the Program.cs) either via uploading the files to our forum or via mail ([email protected]).

Thank you in advance.

Regards,
Robert
.
Image

skhanpara
Posts: 94
Joined: Wed Apr 23, 2014 3:55 pm

Re: Gmail as SMTP

Post by skhanpara » Wed May 07, 2014 4:45 pm

Thank for your reply

I am uploading a sample file i was trying to mail
Attachments
MailReport.zip
(1.58 MiB) Downloaded 129 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Gmail as SMTP

Post by Support Team » Mon May 12, 2014 10:04 am

Hello skhanpara,

You need to use port 25 for your SMTP client.

Please find attached a solution with specified SMTP client for gmail.

Just modify:

Code: Select all

System.Net.NetworkCredential basicCredential = new System.Net.NetworkCredential ("YourEmail", "YourPassword");
within the MailLogger.cs

Code: Select all

MailLogger mailLogger = new MailLogger("From", "To",
                                                   "Ranorex Report for CustomLogging");
within the Program.cs

Regards,
Robert
Attachments
CustomLoggingGmail.zip
(59.68 KiB) Downloaded 135 times
.
Image

skhanpara
Posts: 94
Joined: Wed Apr 23, 2014 3:55 pm

Re: Gmail as SMTP

Post by skhanpara » Mon May 12, 2014 7:41 pm

Thank you so much

skhanpara
Posts: 94
Joined: Wed Apr 23, 2014 3:55 pm

Re: Gmail as SMTP

Post by skhanpara » Tue May 13, 2014 3:36 pm

still i am not able to send
i made all the changes you told me

please advise

swmatisa
Posts: 122
Joined: Fri Aug 05, 2011 7:52 am

Re: Gmail as SMTP

Post by swmatisa » Wed May 14, 2014 9:24 am

Hello,
If you have a proxy, I think you must change your code. Google will help you :D

Hope this help
SW