Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Nov 2012
    Posts
    14
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Unhappy PHPMailer not working since Windows migration

    Hi all,

    I'm working on a web based application for our team at work which basically, collects information inputted by the user via a series of web forms and then collates it all together, and e-mails it to someone.

    Originally, I built this on my personal Linux server and it worked fine. Obviously I don't want to host something for my work on a personal server forever, so we made the decision to migrate to a box within the company. Ever since this, the sendmail part of the script is failing, which frankly is the most fundamental part of it.

    Now, the box at work is a Windows Server box with WAMP installed on it. (As the company do not have any Linux machines apart from a few Redhat boxes used for our NAS platform).

    I'm using PHPMailer to send the final mail as I can point PHPMailer to a dynamic PHP page which can grab data from the SQL db's etc as so:

    PHP Code:
    $mail->Body file_get_contents('mail.php'$data); 
    Now, whenever I go to submit the final form, I am presented with the following errors:



    Please excuse my stupidity if I'm missing something obvious, I've been working on this for sometime and I'm almost losing my mind. If it's any help, the full code of the mailsend is below:

    PHP Code:
    require_once('phpmailer/class.phpmailer.php');

    $mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
    $mail->IsSendmail(); // telling the class to use SendMail transport

      
    function get_include_contents($filename$variablesToMakeLocal) {
        
    extract($variablesToMakeLocal);
        if (
    is_file($filename)) {
            
    ob_start();
            include 
    $filename;
            return 
    ob_get_clean();
        }
        return 
    false;
    }
    $today date("d/m/y");
      
    $mail->AddAddress('xxxxxxxx@xxxxxxx.com''Going to');
      
    $mail->SetFrom('xxxxxxxx@xxxxxxx.com''From name');
      
    $mail->IsHTML(true);    // set email format to HTML
      
    $mail->Subject "[TEST]HANDOVER - Europe - {$today}";
      
    $mail->Body file_get_contents('mail.php'$data); // HTML -> PHP!
      
    $mail->Send(); // send message
      
    echo "Yay."
    Any help will be much appreciated. Thank you in advance.

    P.S: Hope this isn't too long winded!

  • #2
    Regular Coder patryk's Avatar
    Join Date
    Oct 2012
    Location
    /dev/couch
    Posts
    398
    Thanks
    2
    Thanked 64 Times in 64 Posts
    what's $data in $mail->Body = file_get_contents('mail.php', $data);
    http://php.net/manual/en/function.file-get-contents.php

    You prolly need external program to actually send emails. php uses sendmail on linux machines....
    i found this for windows: http://glob.com.au/sendmail/

    --edit--
    or you can try this: https://help.brinkster.com/KB/a106/h...s-hosting.aspx
    (never tested it. not using windows )
    Last edited by patryk; 04-18-2013 at 12:25 PM.

    -------------------------------------------------------------------------------
    "Real Programmers can write assembly code in any language" - Larry Wall


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •