如何在邮件功能中向两个电子邮件ID发送电子邮件

时间:2017-10-07 06:49:48

标签: php email

这是我的代码

$secondEmail="eamail2@gmail.com";

发送邮件两封电子邮件

$to = $email,$secondEmail;
$email_from = 'website.com';
$email_subject = "Register Details: " ;
$email_body = "Sender Name: $from" 

2 个答案:

答案 0 :(得分:0)

您可以添加多封电子邮件With comma separated

$to = "myfirstemail@xyz.com, mysecondemail@xyz.com";
$email_from = 'website.com';
$email_subject = "Register Details: " ;
$email_body = "Sender Name: $from" ;

对于变量,只需将其放入"";

$email1="eamil1@gmail.com";
$email2="email2@gmail.com";
$to = "$email1 , $email2";

答案 1 :(得分:0)

您可以将邮件ID用作字符串,

$to = $email.",".$secondEmail;
$email_from = 'website.com';
$email_subject = "Register Details: " ;
$email_body = "Sender Name: $from"