Hello,
can u help me sending Email with attachments using the Class phpMailer.
On the website I have a link to an html form in which I input the parameters with the names 1)from(textbox name) 2)To 3) Subject 4) Message5) File input(name abc) - to be sent as an attachment.
This form calls the Class PhpMailer through another form with the following code to send the mail.
<?php
ini_set("includ e_path", "http://www.urovisionho spital.com/class.phpmailer .php");
require("class. phpmailer.php") ;
$mail = new PHPMailer();
$mail->From = $_GET["from"];
$mail->FromName = "Mailer";
$mail->AddAddress($_G ET["to"]);
$mail->AddAddress($_G ET["to"]); // name is optional
$mail->AddReplyTo("pr asenjit.sandily a@gmail.com", "Informatio n");
$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->AddAttachment( $_GET["abc"]); // add attachments
$mail->AddAttachment( "/tmp/image.jpg", "new.jpg"); // optional name
$mail->IsHTML(true) ; // set email format to HTML
$mail->Subject = $_GET["subject"];
$mail->Body = $_GET["message"];
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
?>
RESULT:-The mail is sent but without the parameters and also without the attachment.
Please if u could see to correcting the above coding to retrieve the values of the first HTML form into the second php form quoted above in rder to succesfully send the email message with the attachment.
Thanking u,more so if its done.
can u help me sending Email with attachments using the Class phpMailer.
On the website I have a link to an html form in which I input the parameters with the names 1)from(textbox name) 2)To 3) Subject 4) Message5) File input(name abc) - to be sent as an attachment.
This form calls the Class PhpMailer through another form with the following code to send the mail.
<?php
ini_set("includ e_path", "http://www.urovisionho spital.com/class.phpmailer .php");
require("class. phpmailer.php") ;
$mail = new PHPMailer();
$mail->From = $_GET["from"];
$mail->FromName = "Mailer";
$mail->AddAddress($_G ET["to"]);
$mail->AddAddress($_G ET["to"]); // name is optional
$mail->AddReplyTo("pr asenjit.sandily a@gmail.com", "Informatio n");
$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->AddAttachment( $_GET["abc"]); // add attachments
$mail->AddAttachment( "/tmp/image.jpg", "new.jpg"); // optional name
$mail->IsHTML(true) ; // set email format to HTML
$mail->Subject = $_GET["subject"];
$mail->Body = $_GET["message"];
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Message has been sent";
?>
RESULT:-The mail is sent but without the parameters and also without the attachment.
Please if u could see to correcting the above coding to retrieve the values of the first HTML form into the second php form quoted above in rder to succesfully send the email message with the attachment.
Thanking u,more so if its done.
Comment