Problem sending mail using phpMailer class

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • prasenjit2007
    New Member
    • Apr 2007
    • 2

    Problem sending mail using phpMailer class

    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.
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    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

    Comment

    • code green
      Recognized Expert Top Contributor
      • Mar 2007
      • 1726

      #3
      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

      Comment

      Working...