Jump to content

Send mail to 5 more accounts, i need info


nzizo

Recommended Posts

Hello,

 

this is my send mail script with jpg attachment:

<?
$varsendmail = $_POST['varsendmail'];
$vartext = $_POST['vartext'];

$to = $varsendmail;
$subject = 'subject';
$bound_text = "domain";
$bound = "--".$bound_text."\r\n";
$bound_last = "--".$bound_text."--\r\n";
$headers = "From: [email protected]\r\n";
$headers .= "MIME-Version: 1.0\r\n"
         ."Content-Type: multipart/mixed; boundary=\"$bound_text\"";
$message .= "ok \r\n"
         .$bound;
$message .= "Content-Type: text/html; charset=\"utf-8\"\r\n"
         ."Content-Transfer-Encoding: 7bit\r\n\r\n"
         ."ok \r\n"
         .$bound;
$file = file_get_contents("http://www.domain.com/images/image.jpg");
$message .= "Content-Type: image/jpg; name=\"image.jpg\"\r\n"
         ."Content-Transfer-Encoding: base64\r\n"
         ."Content-disposition: attachment; file=\"image.jpg\"\r\n"
         ."\r\n"
         .chunk_split(base64_encode($file))
         .$bound_last;
if(mail($to, $subject, $message, $headers))
{
echo "ok";
} else {
die("error");
}
?>

 

i want to send this mail to 5 more accounts (cc, bcc etc),

please i need an example how to do it.

 

thank you

The values of variables coming by form,

and need to send this mail to more accounts.

 

So, I add the 5 more variables (emails from input fields),

and my question is.. how to send the same email with the attachment also to them?

<?
$varsendmail = $_POST['varsendmail'];
$vartext = $_POST['vartext'];

$varemail1 = $_POST['varemail1'];
$varemail2 = $_POST['varemail2'];
$varemail3 = $_POST['varemail3'];
$varemail4 = $_POST['varemail4'];
$varemail5 = $_POST['varemail5'];

$to = $varsendmail;
$subject = 'subject';
$bound_text = "domain";
$bound = "--".$bound_text."\r\n";
$bound_last = "--".$bound_text."--\r\n";
$headers = "From: [email protected]\r\n";
$headers .= "MIME-Version: 1.0\r\n"
         ."Content-Type: multipart/mixed; boundary=\"$bound_text\"";
$message .= "ok \r\n"
         .$bound;
$message .= "Content-Type: text/html; charset=\"utf-8\"\r\n"
         ."Content-Transfer-Encoding: 7bit\r\n\r\n"
         ."ok \r\n"
         .$bound;
$file = file_get_contents("http://www.domain.com/images/image.jpg");
$message .= "Content-Type: image/jpg; name=\"image.jpg\"\r\n"
         ."Content-Transfer-Encoding: base64\r\n"
         ."Content-disposition: attachment; file=\"image.jpg\"\r\n"
         ."\r\n"
         .chunk_split(base64_encode($file))
         .$bound_last;
if(mail($to, $subject, $message, $headers))
{
echo "ok";
} else {
die("error");
}
?>

 

Thank you

$varsendmail = $_POST['varsendmail'];
$vartext = $_POST['vartext'];

$varemail1 = $_POST['varemail1'];
$varemail2 = $_POST['varemail2'];
$varemail3 = $_POST['varemail3'];
$varemail4 = $_POST['varemail4'];
$varemail5 = $_POST['varemail5'];

$to = "$varsendmail, $varemail1, $varemail2, $varemail3, $varemail4, $varemail5";

 

$varsendmail = $_POST['varsendmail'];
$vartext = $_POST['vartext'];

$varemail1 = $_POST['varemail1'];
$varemail2 = $_POST['varemail2'];
$varemail3 = $_POST['varemail3'];
$varemail4 = $_POST['varemail4'];
$varemail5 = $_POST['varemail5'];

if ($varsendmail) { $to = "$varsendmail,"; }
if ($varemail1) { $to .= "$varemail1,"; }
if ($varemail2) { $to .= "$varemail2,"; }
if ($varemail3) { $to .= "$varemail3,"; }
if ($varemail4) { $to .= "$varemail4,"; }
if ($varemail5) { $to .= "$varemail5,"; }
rtrim($to,',');

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.