vinpkl Posted August 13, 2009 Share Posted August 13, 2009 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 Link to comment https://forums.phpfreaks.com/topic/170079-send-2-emails-with-different-replyto-addresses/ Share on other sites More sharing options...
DEVILofDARKNESS Posted August 13, 2009 Share Posted August 13, 2009 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 Link to comment https://forums.phpfreaks.com/topic/170079-send-2-emails-with-different-replyto-addresses/#findComment-897399 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.