获取多封电子邮件的问题 [英] Problem for getting multiple Emails

查看:89
本文介绍了获取多封电子邮件的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨..

我写了日程安排电子邮件代码。它的工作,但我收到了多封电子邮件。如何删除此问题以及如何只发送一封电子邮件..









提前致谢..

hi..
i write schedule email code. its working but i got multiple emails. how to remove this issue and how to send only one email..




Thanks in advance..

推荐答案

检查您修复发送电子邮件的时间。



以及它开火的时间。
Check for the time you have fixed for sending email.

and how many time it fires.


嗨亲爱的,



试试这段代码。



您执行此代码然后发送一次电子邮件,然后发送多封电子邮件然后用于循环。



hi dear,

try this code.

you are execute this code then email send one time and you are send multiple emails then use for loop.

private void MailSend()
    {
            try
            {
                MailMessage mail = new MailMessage();
                SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");  
                SmtpServer.Host = "smtp.gmail.com";

                mail.From = new MailAddress("FromMailName@gamil.com");
                mail.To.Add("ToMailName@gmail.com");
                mail.Subject = "Test Mail";
                mail.Body = "This is for testing SMTP mail from GMAIL";

                SmtpServer.Port = 587;

                SmtpServer.Credentials = new System.Net.NetworkCredential("ToMailName@gmail.com", "123456"); // User Mail Name And Mail Password
                SmtpServer.EnableSsl = true;

                SmtpServer.Send(mail);              
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }


这篇关于获取多封电子邮件的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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