SitePoint Sponsor

User Tag List

Results 1 to 16 of 16
  1. #1
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    Location
    Coronado
    Posts
    1,666
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    PHPMailer error?

    I have a php page which should send me an email (to my gmail account) but I get an error which I am stuck on
    Mailer Error: Language string failed to load: recipients_failedadmin1sdasp@gmail.com
    Does it mean anything to you?
    Thanks...
    "Oh, and Jenkins--apparently your mother died this morning."

  2. #2
    $this->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Dec 2003
    Location
    Federal Way, Washington (USA)
    Posts
    1,524
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does your script work with other email accounts, or is it just failing with your gmail account? Also, it might be helpful if you showed us some code.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    Showcase your music collection on the Web

  3. #3
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    Location
    Coronado
    Posts
    1,666
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    my bad

    Yes, it was workiong fine with mail(), but because I wanted th add 6 attachments I was told to use php mailer,
    heres the php code
    PHP Code:
     
     
    require("class.phpmailer.php");
     
     
    $mail = new PHPMailer();
     
    $mail->IsHTML(true);       // send as HTML 
     
    $mail->IsSMTP(); // telling the class to use SMTP
     
    $mail->Host "smtp.gmail.com"// SMTP server
     
     
    $mail->Username "admin1sdasp";
     
    $mail->Password "ddd";
     
     
    $mail->From $ASP_Email;
     
    $mail->FromName $ASP_Name;
     
    $mail->AddAddress("admin1sdasp@gmail.com""SDASP Administrator");
     
     
    $mail->Subject "SDASP PROVIDER APPLICATION";
     
     
    $message "These are the values that a user has tried to submit<br />";
     
    $message .= '<form method=post action="http://testing.scasp.com/update_table_provider.php"><br />';
     
    $message .= 'ASP Real Name: <input type="text" name="Real_Name" value="' $Real_Name '"><br />'
     
    ...
     ...
     ...
     
    $message .= 'Attachment 5: <input type="text" name="Image5" value="' $Image5 '"><br />';
     
    $message .= 'Attachment 6: <input type="text" name="Image6" value="' $Image6 '"><br />';
     
     
    $mail->Body $message;
     
    //add atttachments
     
    $mail->AddAttachment($Image1_name);
     
    $mail->AddAttachment($Image2_name);
     
    $mail->AddAttachment($Image3_name);
     
    $mail->AddAttachment($Image4_name);
     
    $mail->AddAttachment($Image5_name);
     
    $mail->AddAttachment($Image6_name); 
     
     if(!
    $mail->Send())
     {
        echo 
    "<p>Message was not sent</p>";
        echo 
    "<p>Mailer Error: " $mail->ErrorInfo."</p>";
        echo 
    "<p>Please notify admin at admin@scasp.com</p>";
     }
     else
     {
        echo 
    "<p>Message has been sent, please allow 24 hours for you web site to be up, thank you.</p>";
     } 
    And heres the page that runs it
    http://scasp.com/testing/request.php
    Thanks
    "Oh, and Jenkins--apparently your mother died this morning."

  4. #4
    $this->toCD-R(LP); vinyl-junkie's Avatar
    Join Date
    Dec 2003
    Location
    Federal Way, Washington (USA)
    Posts
    1,524
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The readme documentation shows the following formats for attachments:

    $mail->AddAttachment("/var/tmp/file.tar.gz"); // add attachments
    $mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // optional name
    Is that the format for the attachments you're trying to use? Put some echo statements in your script just to verify:

    Code:
    echo "Attachment 1: ".$Image1_name."<br>";
    echo "Attachment 2: ".$Image2_name."<br>";
    echo "Attachment 3: ".$Image3_name."<br>";
    echo "Attachment 4: ".$Image4_name."<br>";
    echo "Attachment 5: ".$Image5_name."<br>";
    echo "Attachment 6: ".$Image6_name."<br>";
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more
    Showcase your music collection on the Web

  5. #5
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    Location
    Coronado
    Posts
    1,666
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Yes, but I'm trying to attach something thats an upload button to the user, which I use php to make a variable
    PHP Code:
       // Obtain file upload vars
       
    $Image1      $_FILES['Image1']['tmp_name'];
       
    $Image1_type $_FILES['Image1']['type'];
       
    $Image1_name $_FILES['Image1']['name'];
       
    $Image2      $_FILES['Image2']['tmp_name'];
       
    $Image2_type $_FILES['Image2']['type'];
       
    $Image2_name $_FILES['Image2']['name'];
       
    $Image3      $_FILES['Image3']['tmp_name'];
       
    $Image3_type $_FILES['Image3']['type'];
       
    $Image3_name $_FILES['Image3']['name'];
       
    $Image4      $_FILES['Image4']['tmp_name'];
       
    $Image4_type $_FILES['Image4']['type'];
       
    $Image4_name $_FILES['Image4']['name'];
       
    $Image5      $_FILES['Image5']['tmp_name'];
       
    $Image5_type $_FILES['Image5']['type'];
       
    $Image5_name $_FILES['Image5']['name'];
       
    $Image6      $_FILES['Image6']['tmp_name'];
       
    $Image6_type $_FILES['Image6']['type'];
       
    $Image6_name $_FILES['Image6']['name']; 
    then, would this work
    PHP Code:
       //add atttachments
       
    $mail->AddAttachment($Image1_name);
       
    $mail->AddAttachment($Image2_name);
       
    $mail->AddAttachment($Image3_name);
       
    $mail->AddAttachment($Image4_name);
       
    $mail->AddAttachment($Image5_name);
       
    $mail->AddAttachment($Image6_name); 
    or how would I do it?
    Thanks
    What gets output is
    AddAttachment1:sample1.gif
    From
    PHP Code:
      echo "AddAttachment1:".$Image1_name."<br>"
    but how do I get a /images/ASP_photos/ before it?
    "Oh, and Jenkins--apparently your mother died this morning."

  6. #6
    Resident Code Monkey Chris Corbyn's Avatar
    Join Date
    Nov 2005
    Location
    Melbourne, Australia
    Posts
    713
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by lukeurtnowski
    but how do I get a /images/ASP_photos/ before it?
    Concatenate the string using a dot ".". But why do you need to do that? tmp_name is where the file is.

    PHPMailer's memory usage on attachments isn't great. Especially if you're sending 6 you may risk hitting the 8MB limit even on smallish attachments.

    Take a look at these figures: http://www.swiftmailer.org/phpmailer/ (about 3/4 down the page)

    Swift would do it like this, and use at least 20% memory. PHPMailer seemed to hang lots when I used to use it.

    PHP Code:
    $mailer->addAttachment(file_get_contents($Image1), $image1_name$image1_type);
    $mailer->addAttachment(file_get_contents($Image2), $image2_name$image2_type);
    // repeat for each attachment 

  7. #7
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    Location
    Coronado
    Posts
    1,666
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    like this?
    PHP Code:
      require('Swift.php'); 
      require(
    'Swift/Swift_SMTP_Connection.php');  
      
    //Specify secure TLS when we make the connection 
      
    $swift = new Swift(new Swift_SMTP_Connection('smtp.gmail.com'465SWIFT_TLS)); 
        
       
      
    //Log in to the server 
      
    $swift->authenticate('sdasp1admin@gmail.com''dragon01'); 
       
      if (!
    $swift->hasFailed()) 
       
      
    $message "These are the values that a user has tried to submit<br />"
      
    $message .= '<form method=post action="http://testing.scasp.com/update_table_provider.php"><br />'
      
    $message .= 'ASP Real Name: <input type="text" name="Real_Name" value="' $Real_Name '"><br />'
      
    $message .= 'ASP Phone: <input type="text" name="ASP_Phone" value="' $ASP_Phone '"><br />';   
      
    $message .= 'Display Phone: <input type="text" name="Display_Phone" value="' $Display_Phone '"><br />'
      
    $message .= 'ASP Email: <input type="text" name="ASP_Email" value="' $ASP_Email '"><br />'
      
    $message .= 'Display Email: <input type="text" name="Display_Email" value="' $Display_Email '"><br />'
      
    $message .= 'ASP Website: <input type="text" name="Website" value="' $Website '"><br />';   
      
    $message .= 'ASP Website URL: <input type="text" name="Website_URL" value="' $Website_URL '"><br />'
      
    $message .= 'ASP Ethnicity: <input type="text" name="Ethnicity" value="' $Ethnicity '"><br />'
      
    $message .= 'ASP Age: <input type="text" name="Age" value="' $Age '"><br />'
      
    $message .= 'ASP Eye Color: <input type="text" size="40" name="Eye" value="' $Eye '"><br />'
      
    $message .= 'ASP Hair Color: <input type="text" name="Hair" value="' $Hair '"><br />'
      
    $message .= 'ASP Hair Length: <input type="text" name="Hair_Length" value="' $Hair_Length '"><br />';   
      
    $message .= 'ASP Bust: <input type="text" name="Bust " value="' $Bust '"><br />'
      
    $message .= 'ASP Cup Size: <input type="text" name="Cup" value="' $Cup '"><br />'
      
    $message .= 'Implants: <input type="text" name="Implants" value="' $Implants '"><br />'
      
    $message .= 'ASP Waist: <input type="text" name="Waist" value="' $Waist '"><br />'
      
    $message .= 'ASP Hips: <input type="text" name="Hips" value="' $Hips '"><br />'
      
    $message .= 'ASP Intimate Grooming: <input type="text" name="Grooming" value="' $Grooming '"><br />'
      
    $message .= 'ASP Piercings: <input type="text" size="40" name="Piercings" value="' $Holes '"><br />'
      
    $message .= 'ASP Tatoos: <input type="text" name="Tatoos" value="' $Tatoos '"><br />'
      
    $message .= 'On Time: <input type="text" name="On_Time" value="' $On_Time '"><br />'
      
    $message .= 'Hourly Rate: <input type="text" name="Hourly_Rate" value="' $Hourly_Rate '"><br />'
      
    $message .= 'Availibility: <input type="text" name="Availability" value="' $Availability '"><br />'
      
    $message .= 'Offered Service: <input type="text" name="Offered_Service" value="' $O_Service '"><br />'
      
    $message .= 'Rules: <input type="text" name="Rules" value="' .$Rules '"><br />'
      
    $message .= 'Reviews Available: <input type="text" name="Reviews" value="' $Reviews '"><br />'
      
    $message .= 'Review URL: <input type="text" name="Reviews_URL" value="' $Reviews_URL '"><br />'
      
    $message .= 'ASP Attire: <input type="text" name="Attire" value="' $Attire '"><br />'
      
    $message .= 'Who Am I: <input type="text" name="Who" value="' $Who '"><br />'
      
    $message .= 'Attachment 1: <input type="text" name="Image1" value="' $Image1 '"><br />'
      
    $message .= 'Attachment 2: <input type="text" name="Image2" value="' $Image2 '"><br />'
      
    $message .= 'Attachment 3: <input type="text" name="Image3" value="' $Image3 '"><br />'
      
    $message .= 'Attachment 4: <input type="text" name="Image4" value="' $Image4 '"><br />'
      
    $message .= 'Attachment 5: <input type="text" name="Image5" value="' $Image5 '"><br />'
      
    $message .= 'Attachment 6: <input type="text" name="Image6" value="' $Image6 '"><br />'
       
      
    $mail->addPart($message); 
       
      
    $mail->addAttachment(file_get_contents($Image1), $Image1_name$Image1_Type); 
      
    $mail->addAttachment(file_get_contents($Image2), $Image2_name$Image2_Type); 
      
    $mail->addAttachment(file_get_contents($Image3), $Image3_name$Image3_Type); 
      
    $mail->addAttachment(file_get_contents($Image4), $Image4_name$Image4_Type); 
      
    $mail->addAttachment(file_get_contents($Image5), $Image5_name$Image5_Type); 
      
    $mail->addAttachment(file_get_contents($Image6), $Image6_name$Image6_Type); 
       
      if (!
    $swift->hasFailed()) 
      { 
       
          
    $swift->send
              
    '$ASP_Name <$ASP_Email>'
       
              
    '"Administrator" <sdasp1admin@gmail.com>'
       
              
    'SDASP PROVIDER APLICATION'
             
          
    $message
         ); 
       
          
    $swift->close(); 
       
      } 
    Is it ok to use my variable ($message) in the emails body?
    Thanks

    Whenever I rn the code, I get this error?
    Parse error: syntax error, unexpected T_STRING in /home/scaspco/public_html/testing/Swift.php on line 68
    Do you know what it means?

    Last edited by lukeurtnowski; Jul 22, 2006 at 13:44.
    "Oh, and Jenkins--apparently your mother died this morning."

  8. #8
    Resident Code Monkey Chris Corbyn's Avatar
    Join Date
    Nov 2005
    Location
    Melbourne, Australia
    Posts
    713
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by lukeurtnowski
    Whenever I rn the code, I get this error?
    Parse error: syntax error, unexpected T_STRING in /home/scaspco/public_html/testing/Swift.php on line 68
    Do you know what it means?

    Yes. It means you downloaded the PHP5 version and tried running it on PHP4.

  9. #9
    Resident Code Monkey Chris Corbyn's Avatar
    Join Date
    Nov 2005
    Location
    Melbourne, Australia
    Posts
    713
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK. Where is $image1 etc etc defined? I don't see it in your new code anymore.

    Your first call to if (!$swift->hasFailed()) is doing absolutely nothing since there's no braces

    $message is fine to use as the message body yes, just make sure you set the content-type to text/html though when you call addPart(). It's in the documentation for it.

    Run the PHP4 version. On a side note does anyone know why my check isn;t working and is still letting PHP use the PHP5 version on PHP4?

    PHP Code:
    if (substr(PHP_VERSION01) != 5) exit("<br /><strong style=\"background: #ee6666;\">SWIFT ERROR:</strong> This version of Swift is for PHP5 only, make sure you have the correct version.<br />"); 

  10. #10
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    Location
    Coronado
    Posts
    1,666
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    OK, uploades the 2 files for my version of php (how did you know this?)
    new error
    Fatal error: Call to a member function on a non-object in /home/scaspco/public_html/testing/request.php on line 140
    heres line 140
    PHP Code:
    $mail->addPart($message); 
    Heres where I get the variables for my image.
    PHP Code:
    $mail->addAttachment(file_get_contents($Image1), $Image1_name$Image1_Type);
    $mail->addAttachment(file_get_contents($Image2), $Image2_name$Image2_Type);
    $mail->addAttachment(file_get_contents($Image3), $Image3_name$Image3_Type);
    $mail->addAttachment(file_get_contents($Image4), $Image4_name$Image4_Type);
    $mail->addAttachment(file_get_contents($Image5), $Image5_name$Image5_Type);
    $mail->addAttachment(file_get_contents($Image6), $Image6_name$Image6_Type); 
    Thanks...
    "Oh, and Jenkins--apparently your mother died this morning."

  11. #11
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    Location
    Coronado
    Posts
    1,666
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    made the change,
    PHP Code:
    $mail->addPart(file_get_contents('$message'), 'text/html'); 
    and get the error,
    Fatal error: Call to a member function on a non-object in /home/scaspco/public_html/testing/request.php on line 140
    Thanks
    My images are defined at
    PHP Code:
     // Obtain file upload vars
     
    $Image1      $_FILES['Image1']['tmp_name'];
     
    $Image1_type $_FILES['Image1']['type'];
     
    $Image1_name $_FILES['Image1']['name'];
     
    $Image2      $_FILES['Image2']['tmp_name'];
     
    $Image2_type $_FILES['Image2']['type'];
     
    $Image2_name $_FILES['Image2']['name'];
     
    $Image3      $_FILES['Image3']['tmp_name'];
     
    $Image3_type $_FILES['Image3']['type'];
     
    $Image3_name $_FILES['Image3']['name'];
     
    $Image4      $_FILES['Image4']['tmp_name'];
     
    $Image4_type $_FILES['Image4']['type'];
     
    $Image4_name $_FILES['Image4']['name'];
     
    $Image5      $_FILES['Image5']['tmp_name'];
     
    $Image5_type $_FILES['Image5']['type'];
     
    $Image5_name $_FILES['Image5']['name'];
     
    $Image6      $_FILES['Image6']['tmp_name'];
     
    $Image6_type $_FILES['Image6']['type'];
     
    $Image6_name $_FILES['Image6']['name']; 
    "Oh, and Jenkins--apparently your mother died this morning."

  12. #12
    Resident Code Monkey Chris Corbyn's Avatar
    Join Date
    Nov 2005
    Location
    Melbourne, Australia
    Posts
    713
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Come on dude. You've really got to start thinking before you post

    $mail isn't what you called the Swift instance. You called it $swift. Read the error messages

  13. #13
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    Location
    Coronado
    Posts
    1,666
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Sorry, I'll slow down more, the only reason I really didn't think cause I didn't want you to get impatient, but ill do that.
    Thanks...
    "Oh, and Jenkins--apparently your mother died this morning."

  14. #14
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    Location
    Coronado
    Posts
    1,666
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    K, made some adjustments and I'm really stuck now (cant figure out this error) Attached is a screenshot of the error and the whole php page zipped. Can you please take a look at it and soo where my new error is?
    Thanks
    Attached Images Attached Images
    Attached Files Attached Files
    "Oh, and Jenkins--apparently your mother died this morning."

  15. #15
    Resident Code Monkey Chris Corbyn's Avatar
    Join Date
    Nov 2005
    Location
    Melbourne, Australia
    Posts
    713
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You keep emailing me and posting on here. If you read the error messages then we wouldn't have to do it for you The errors give you line numbers and the line numbers all have extremely blatant errors on them. One of which I've already asked you to fix but you haven't.

  16. #16
    SitePoint Wizard lukeurtnowski's Avatar
    Join Date
    Mar 2003
    Location
    Coronado
    Posts
    1,666
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    I'm sorry, I made the changes to another file and sent you the one without the changes, my mistake.
    Thanks for pointing out my error.
    "Oh, and Jenkins--apparently your mother died this morning."


Bookmarks

Posting Permissions

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