发送电子邮件到多个地址 [英] Send Email to Multiple Address

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

问题描述

如何将邮件发送给多个用户.

我想在用分号分隔的文本框中输入收件人的地址(txttoadress.text).

How can I send mail to multiple users.

I want to enter the addresses of the receivers in a textbox (txttoadress.text)separated by semicolon.

推荐答案

public static void SendQuickMails(string from, string to, string subject, string body)
{
    MailMessage mailMsg = new MailMessage();
    mailMsg.From = new MailAddress(from);

    string[] tos = to.Split('';'');
    for (int a = 0; a < tos.Length; a++)
    {
        if (tos[a].Trim().Length != 0)
            mailMsg.To.Add(new MailAddress(tos[a]));
    }

    mailMsg.Subject = subject;
    mailMsg.Body = body;
    mailMsg.IsBodyHtml = true;
    mailMsg.Priority = MailPriority.High;

    SmtpClient mSmtpClient = new SmtpClient(); //provide your user name or password here
    mSmtpClient.Send(mailMsg);
}



您可以传递以分号(;)分隔的多封电子邮件



you can pass multiple emails separated by semicolon (;)


只需将多个电子邮件地址添加到邮件中的收件人".
以'';''
分隔
如果您询问如何发送邮件,请查看"system.net.mail"命名空间.
Just add the multiple e-mail addresses to the ''To'' from your mail message.
Separated by '';''

If your asking how to send a mail take a look at the ''system.net.mail'' namespace.


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

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