需要向多个收件人发送电子邮件. [英] Need to send Email to the Multiple Recipients.

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

问题描述



在我的项目中,用户将与我们一起确定约会.如果他确认任命,我需要发送电子邮件给他.请发送一些与此有关的文章链接.我在互联网上搜索过,我得到的教程仅用于接收来自收件人的电子邮件,所以我要问您链接.

谢谢

Hi,

In my project, the user is going to fix the appointment with us. If he confirms his appointment I need to send the email to him. Please send some article links regarding this. I have searched in the internet i am getting the tutorials only for receiving the email from the recipients, so i am asking you the links.

Thanks

推荐答案

尝试一下:

命名空间:
Try this:

Namespaces:
using System.Collections; //ArrayList
using System.Data.SqlClient; //SQL
using System.Net.Mail; //email


代码:


Code:

private void btnSend_Email_Click(object sender, EventArgs e)
        {
            ArrayList list_emails = new ArrayList();
            int i = 0, email = 0;
            sqlConnection1.Open(); //connection to the database.
            SqlCommand cmd_Email = new SqlCommand("Select Email from Email_Table", sqlConnection1);
            SqlDataReader read_Email = cmd_Email.ExecuteReader();
            while (read_Email.Read())
            {
                email = read_Email.GetValue(i).ToString();
                list_emails.Add(email); //Add email to a arraylist
                i = i + 1 - 1; //increment or ++i
            }
            read_Email.Close();
            sqlConnection1.Close(); //Close connection
 
            foreach (string email_to in list_emails)
            {
                MailMessage mail = new MailMessage();
                mail.To.Add(email_to);
                mail.Subject = "Welcome to C#";
                mail.From = new MailAddress(hold_Account);
                mail.Body = "Test";
                SmtpClient smtp = new SmtpClient("SMTP Server");
                smtp.Send(mail);
            }


参考号:发送电子邮件至多个电子邮件地址 [ ^ ]


Ref.: send email to multiple email addresses [^]


我想您的搜索不够好.
有数十种发送电子邮件的资源-
使用ASP.NET和C#发送邮件/联系表 [ ^ ]
http://csharp.net-informations.com/communications/csharp-smtp-mail.htm [^ ]
http://www.emailarchitect.net/easendmail/kb/csharp.aspx [ ^ ]
I guess you did not search well enough.
There are dozens of resources on sending emails -
Send Mail / Contact Form using ASP.NET and C#[^]
http://csharp.net-informations.com/communications/csharp-smtp-mail.htm[^]
http://www.emailarchitect.net/easendmail/kb/csharp.aspx[^]


这篇关于需要向多个收件人发送电子邮件.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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