iantooke Posted February 25, 2010 Share Posted February 25, 2010 Hello, I wonder if someone could help me out, I have a script which sends out an email but i really want to add a picture at the top (Company Logo etc) i have tried playing around with the code but it will not work?? Could anyone give me a pointer in the right direction Many Thanks /*Sending mail to customer*/ $exp_dt_crt = explode(',',substr($out_date,0,-1)); foreach($exp_dt_crt as $v) { $exp_dt_crt_n = explode('-',$v); $f_exp_date .= $exp_dt_crt_n[2].'/'.$exp_dt_crt_n[1].'/'.$exp_dt_crt_n[0].','; } $f_date = substr($f_exp_date,0,-1); $re=mysql_query("select * from `drivers` where `d_id`='$out_driver'")or die(mysql_error()); $r_re=mysql_fetch_array($re); $drv_name = $r_re['d_name']; $drv_phone = $r_re['d_phone']; $to=$cust_email_add; $result9=mysql_query("select * from `mail_format` where `mail_id`='1'")or die(mysql_error()); $result7=mysql_query("select * from `mail_format` where `mail_id`='10'")or die(mysql_error()); $result8=mysql_query("select * from `mail_format` where `mail_id`='7'")or die(mysql_error()); $r=mysql_fetch_array($result9); //echo 'customer<br/>'; $subject='Outbound Booking Confirmation'; $r1=mysql_fetch_array($result7); $r2=mysql_fetch_array($result8); $messagebody ="<html><body><p>Below is confirmation of your booking with Travel.</p>"; $messagebody .="<p><u><b>Booking Details</b></u><br></p>"; $messagebody .='Hello, '.$cust_name_add."<br>"."<br>". 'Booking type:- '.' Outbound'."<br>". /*'Booking date:- '. date('d/m/Y')."<br>".*/ 'Customer name:- '.$cust_name_add."<br>". 'Departure date:- '.$f_date."<br>". 'Pick up time:- '.$out_time_collection."<br>". 'Terminal:- '.$out_terminal."<br>". 'Pick up point:- '.$out_pick_add."<br>". 'Drop off point:- '.$out_drop_add."<br>". 'Number of passengers:- '.$out_people."<br>". 'Additional Information:- '.$out_comment."<br>". 'Price:- '.$out_price."<br>". 'Driver Name:- '.$drv_name."<br>". 'Driver Phone:- '.$drv_phone."<br>"."<br>". 'Terms and Conditions:- '.$r1['mail_content'].'<br>'."<br>"; $messagebody .="Thank you. <br></body></html>"; $mailheaders = "From: Travel <[email protected]> \n"; $mailheaders .= 'MIME-Version: 1.0' . "\n"; $mailheaders .= 'Content-type: text/html; charset=iso-8859-1' . "\n"; set_time_limit(0); ignore_user_abort(true); $form = '[email protected]'; $m = new dSendMail2; $mailid = $cust_email_add; //$mailid='[email protected]'; $m->setTo($mailid); $m->setFrom($form); $m->setSubject($subject); $m->setMessage($messagebody); $m->send(); Link to comment https://forums.phpfreaks.com/topic/193356-php-send-email-with-picture/ Share on other sites More sharing options...
inspireddesign Posted February 25, 2010 Share Posted February 25, 2010 This is going to be a silly question but are you using a direct path to the image you want to insert into the email... you can't just add an image it has to reside somewhere and you have to link to it. Link to comment https://forums.phpfreaks.com/topic/193356-php-send-email-with-picture/#findComment-1018057 Share on other sites More sharing options...
iantooke Posted February 25, 2010 Author Share Posted February 25, 2010 Hi inspireddesign, Thanks for your reply, Yes, i was thinking of linking the image from our website http:// etc etc, or embedding the image (so it sends as an attachment) Many Thanks Ian Link to comment https://forums.phpfreaks.com/topic/193356-php-send-email-with-picture/#findComment-1018068 Share on other sites More sharing options...
jl5501 Posted February 25, 2010 Share Posted February 25, 2010 Seeing as how you are sending html mail, then you can just include the html for an <img> tag in there with the full url to the image Link to comment https://forums.phpfreaks.com/topic/193356-php-send-email-with-picture/#findComment-1018074 Share on other sites More sharing options...
iantooke Posted February 25, 2010 Author Share Posted February 25, 2010 Hello, Yes i did try that two different ways, Unfortuntely both ways cause a Parse error: syntax error, unexpected T_STRING?? $messagebody ="<html><img src="http://www.domainname.co.uk/headerpic.jpg" width="462" height="229"><body><p>Below is confirmation of your booking with Travel.</p>"; $messagebody ="<html><body><img src="http://www.domainname.co.uk/headerpic.jpg" width="462" height="229"><p>Below is confirmation of your booking with Travel.</p>"; Link to comment https://forums.phpfreaks.com/topic/193356-php-send-email-with-picture/#findComment-1018084 Share on other sites More sharing options...
jl5501 Posted February 25, 2010 Share Posted February 25, 2010 $messagebody ='<html><body><img src="http://www.domainname.co.uk/headerpic.jpg" width="462" height="229"><p>Below is confirmation of your booking with Travel.</p>'; Link to comment https://forums.phpfreaks.com/topic/193356-php-send-email-with-picture/#findComment-1018188 Share on other sites More sharing options...
iantooke Posted February 26, 2010 Author Share Posted February 26, 2010 jl5501 your a star, It Works.. Thank You Link to comment https://forums.phpfreaks.com/topic/193356-php-send-email-with-picture/#findComment-1018315 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.