如何使用IMAP协议在服务器上发送大量电子邮件? [英] How to send a mass email on a server use IMAP protocol ?

查看:247
本文介绍了如何使用IMAP协议在服务器上发送大量电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



对不起,我的英文,

我创建了一个程序,用于向使用IMAP协议的邮件服务器发送大量电子邮件,我使用了smtp.gmail.com的相似代码,并且在发送时,我始终收到此错误:远程根据验证程序,证书无效.
这是我的代码:

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:

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)


您是否有针对此错误消息的解决方案?或解决此问题需要做什么?

谢谢

马塞尔
mprim58@yahoo.com


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

Thanks

Marcel
mprim58@yahoo.com

推荐答案

效果很好,但是在C#中,请尝试理解.它将对您有所帮助
It works well,But it is in C#,Try to understand.It will helps you
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;
            }
        }


这篇关于如何使用IMAP协议在服务器上发送大量电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆