Send attatchment using php mail() -


i want attach image attachment using mail() function.
using xampp , want image sent computer email id. code sending text email easily:

<?php      if(mail('abc@gmail.com','hello','testing  testing','from:xyz@gmail.com'))     {        echo "success";     } else {        echo "fail";     } ?> 

i want add image after using normal mail method of php.

you need use pear library composing or sending mail.

 include_once('mail.php');  include_once('mail_mime/mime.php');  $message = new mail_mime();   $message->settxtbody($text);  $message->addattachment($path_of_uploaded_file);  $body = $message->get();  $extraheaders = array("from"=>$from, "subject"=>$subject,"reply-to"=>$visitor_email);  $headers = $message->headers($extraheaders);  $mail = mail::factory("mail");  $mail->send($to, $headers, $body); 

here way


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -