//ads:
?>
How to send upload image through email
PHP Snippet 1:
<?php
require 'PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->setFrom('[email protected]', 'Mailer');
$mail->addAddress('[email protected]', 'Joe User'); // Add a recipient
$mail->addAddress('[email protected]'); // Name is optional
$mail->addReplyTo('[email protected]', 'Information');
$mail->addCC('[email protected]');
$mail->addBCC('[email protected]');
$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
PHP Snippet 2:
function sendEmail($email,$subject,$content,$sent_from_email_address,$b_frontPhot??o,$b_backPhoto,$b_si??dePhoto) {
///////////////////////////////// Passed the photos to the function ^^^^^^^^^^^^^^^^^^^^^
$b_frontPhot??o = $b_frontPhot??o['tmp_name'];
$b_backPhot??o = $b_backPhot??o['tmp_name'];
$b_sidePhot??o = $b_sidePhot??o['tmp_name'];
//^^^^^^ Try adding these in ^^^^^^^^^^^^^^^^^^
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "stuff";
$mail->SMTPAuth = true;
$mail->Username = "stuuff";
$mail->Password = "stuff";
$mail->Port = "stuff";
$mail->setFrom($sent_from_email_address, "stuff");
$mail->Encoding = "stuff";
$mail->Subject = $subject;
$mail->msgHTML($content);
$mail->AddAddress($email);
// Attach the files to the email
$mail->addAttachment($b_frontPhoto);
$mail->addAttachment($b_backPhoto);
$mail->addAttachment($b_sidePhoto);
if (!$mail->Send())
return 0;
else
return 1;
}///// close function /////