How can I add a .png to an outgoing PHP Email with HTML? -


i've been trying add png php email quite sometime no luck. tried traditional methods , i've tried add base64 both html , css using site http://www.base64-image.de

but no matter blank header. can please tell me, step step have make png appear on email send, , no can't attachment. thanks in advanced.

 <?php  // $email , $message data being // posted page our html contact form $email = $_request['email'] ;  $mail2 = new phpmailer();  // set mailer use smtp $mail2->issmtp();  // email.php script lives on same server our email server // setting host localhost $mail2->host = "smtp.comcast.net"; // specify main , backup server  $mail2->smtpauth = true; // turn on smtp authentication  // when sending email using phpmailer, need send valid email address // in case, setup test email account following credentials: // email: send_from_name@comcast.net // pass: password $mail2->username = "name@comcast.net"; // smtp username $mail2->password = "*******"; // smtp password $mail2->smtpsecure = 'ssl';                            // enable tls encryption, `ssl` accepted $mail2->port = 465;                                    // tcp port connect   // $email user's email address specified // on our contact page. set variable @ // top of page with: // $email = $_request['email'] ; //$mail2->from = 'user@gmail.com';   //set message sent $mail2->setfrom('user@gmail.com', 'user');   // below want set email address sending our email to. $mail2->addaddress("$email");  //set alternative reply-to address $mail2->addreplyto('talk@gmail.com');   // below want set email address sending our email to. //$mail2->addaddress("$email");  // set word wrap 50 characters $mail2->wordwrap = 50; // set email format html $mail2->ishtml(true);  mail($to, $subject, $message, $headers);  $mail2->subject = "thanks";   $headers = "from: " . strip_tags($_post['user@gmail.com']) . "\r\n"; $headers .= "reply-to: ". strip_tags($_post['talk@gmail.com']) . "\r\n"; $headers .= "mime-version: 1.0\r\n"; $headers .= "content-type: text/html; charset=iso-8859-1\r\n";   $message = '<html><body>';  $message .= '<div style="height:130px; text-align:center; width:100%; background:#666;"> <img src="images/logo.png"/></div>';  $message .= '<p>welcome,</p> '; $message .= "<p>you have been added</p>";   $message .= "</body></html>";  // $message user's message typed in // on our contact page. set variable @ // top of page with: // $message = $_request['message'] ; $mail2->body = $message; $mail2->altbody = $message;  if(!$mail2->send()) { echo "message not sent. <p>"; echo "mailer error: " . $mail2->errorinfo; exit; }  echo "message has been sent";  ?> 

this confused. why calling mail() using phpmailer? i've no idea why think need mess headers manually - point of using library phpmailer don't have concern things that!

phpmailer not image path if set body - need pass body msghtml() images , convert embedded images.

there examples provided phpmailer show how (if not in examples folder, @ unit tests).

i can see you've based code on old example , using old version of phpmailer, suggest update @ least 5.2.10.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -