Click here to Skip to main content
15,896,489 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Sorry my english,

I create a program to use for sending a mass email for a mail server that use IMAP protocol, I use a similary code of the smtp.gmail.com and when I send,I received all the time this error : The remote certificate is invalid according to the validation procedure.
This is my code:

VB
Dim SmtpServer As New SmtpClient()
SmtpServer.Credentials = New Net.NetworkCredential("info@abc.com", "xxxx")
SmtpServer.Host = "smtp.abc.com"
SmtpServer.Port = 587
SmtpServer.EnableSsl = True

EMail.From = New System.Net.Mail.MailAddress("info@abc.com")

SmtpServer.Send(EMail)

Do you have a solution for this error message? or what I need to do for fixing this problem?

Thanks

Marcel
mprim58@yahoo.com
Posted
Updated 23-Sep-11 2:38am
v2

1 solution

It works well,But it is in C#,Try to understand.It will helps you
C#
public static Boolean SendingMail(string From, string To, string Subject, string Body)
    {
        
            try
            {
                MailMessage m = new MailMessage("Senedr<id@domain.com>", To);
                m.Subject = Subject;
                m.Body = Body;
                m.IsBodyHtml = true;
                m.From = new MailAddress(From);

                m.To.Add(new MailAddress(To));
                SmtpClient smtp = new SmtpClient();
                smtp.Host = "smtp.gmail.com";
              
                NetworkCredential authinfo = new NetworkCredential("id@domain.com", "pwd");
                smtp.UseDefaultCredentials = false;
                smtp.Credentials = authinfo;
                smtp.Send(m);
                return true;

               


            }
            catch (Exception ex)
            {
                return false;
            }
        }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900