By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,521 Members | 1,447 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,521 IT Pros & Developers. It's quick & easy.

Problem sending mail using phpMailer class

P: 2
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("include_path", "http://www.urovisionhospital.com/class.phpmailer.php");

require("class.phpmailer.php");

$mail = new PHPMailer();

$mail->From = $_GET["from"];
$mail->FromName = "Mailer";
$mail->AddAddress($_GET["to"]);
$mail->AddAddress($_GET["to"]); // name is optional
$mail->AddReplyTo("prasenjit.sandilya@gmail.com", "Information");

$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.
May 9 '07 #1
Share this Question
Share on Google+
2 Replies


Atli
Expert 5K+
P: 5,058
I have a rather limited knowledge of this particular class, but I would think you would have to specify the smtp host, or somehing like that.

This is the official tutorial for the class
May 10 '07 #2

code green
Expert 100+
P: 1,726
RESULT:-The mail is sent but without the parameters and also without the attachment.
I would guess that you have phpMailer working OK but problems with your form variables
May 10 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.