I am new to PHP, I want to send emails to multiple recipients but from same mail client using mailto option in php for example I have an array containing email addresses. I tried this:
$recipients = array(
"youremailaddress@yourdomain.com",
"youremailaddress2@yourdomain.com",
);
$email_to = implode(',', $recipients);
$body = "Body";
But this will add all recipients on same email. I need to create separate Draft for all receivers and I want only one receiver in one draft. I can't use BCC. Can anyone help me out for creating mails using:
"<a href='mailto:".$email_to."?body=".$body."' target='_top'> </a>"
Well, supposing that what I commented was what you were looking for, I would do the following (you can edit it to just echo the whole thing):
$body = "Body";
$recipients = array(
"youremailaddress@yourdomain.com",
"youremailaddress2@yourdomain.com",
);
foreach($recipients as $v){
$a_tags .= '<a href="mailto:'.$v.'?body='.$body.'" target="_top"> </a>';
}
Note that I'm using .=
so I can concatenate all the <a>
tags, you can later output your $a_tags
variable wherever you want.