私はこのコードを使用してyahooからメールを送信しています。複数のアドレスにYahoo!メールを送信
string smtpAddress = "smtp.mail.yahoo.com";
int portNumber = 587;
bool enableSSL = true;
string emailFrom = "[email protected]";
string password = "xxxxxx!";
string emailTo = "[email protected]";
string subject = "Hello";
string body = "Hello, I'm just writing this to say Hi!";
using (MailMessage mail = new MailMessage())
{
mail.From = new MailAddress(emailFrom);
mail.To.Add(emailTo);
mail.Subject = subject;
mail.Body = body;
mail.IsBodyHtml = true;
// Can set to false, if you are sending pure text.
using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber))
{
smtp.Credentials = new NetworkCredential(emailFrom, password);
smtp.EnableSsl = enableSSL;
smtp.Send(mail);
メールアドレスを追加したい場合はどうすればよいですか?私はこれを試してみましたが、私はエラーを取得:
string emailTo = "[email protected]" ,"[email protected]" ;
これを試してみてください: '' 'string emailTo =" [email protected]、[email protected] ";' '' '(すべての電子メールアドレスは" " - つまり" ") –
scana