Jump to content

send 2 emails with different replyto addresses


vinpkl

Recommended Posts

hi all

 

i am sending email with php mail().

 

i m using the following headers

$to= $log_id;
$subject= "welcome to company";
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From:[email protected]' . "\r\n";
$headers .= "CC:[email protected]" . "\r\n";
$headers .= "Reply-To:".$log_id . "\r\n";
$headers .= "Return-Path:".$log_id . "\r\n";

$body=" ";
if(mail($to,$subject,$body,$headers))
{
$msg="email processed";;
}
else
{
$msg="order not processed";
}

 

This email function works fine and email is sent successfully.

 

Now i want to send one more email with Different "Reply to" address and rest all remains same.

 

As the $body test is lengthy, so i want to ask that instead of writing two separate full emails code,

is there anyother way i can sent two emails simultaneously without repeating my $body code but with different "Reply-To" addresses.

 

vineet

Yes there is, by using regex it should be possible, or just using str_replace.

I'm not an expert with those functions but it is possible.

str_replace(' "Reply-To:".$log_id',' "Reply-To:".$second_log_id',$headers)

str_replace("text to be changed","changed text","text where to seek in")

Hope this helped

 

Kruptein

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.