Jump to content

usit

New Members
  • Posts

    2
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

usit's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Good idea Krash, but I fear that the road back to php4 is fraught with pot holes. A variety of changes were made to the original script with, I fear, incomplete documentation -- the foible of an autodidactic programmer. I will check your solution with my host. Then, if it can be implemented, and no other idea surfaces for using php5, I'll start on the road back. Thanks for your quick reply and neat idea. usit/ens
  2. Code transition from PHP4 to PHP5 My oop skills are weak – I need help converting an old version of PHPMailer to PHPMailer_v2.0.4. I assembled an on-line registration/mail script from open source codes and the resulting package has worked well for 8 or 9 years until some changes at my web host occurred. These led to my host switching my compiler, at my request, from PHP4 to PHP5. I then downloaded PHPMailer_v2.0.4 and tried to clean up the results, and am still trying. In the README that came with PHPMailer_v2.0.4 is this nice small script, by Andy Prevost, that I am using to replace the smtp mail section of my older code. The script, sans comments, is ... <?php require("class.phpmailer_v204.php"); //I added the ver. no. because several different ones exist out there. $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = "smtp1.example.com;smtp2.example.com"; $mail->SMTPAuth = true; $mail->Username = "jswan"; $mail->Password = "secret"; $mail->From = "from@example.com"; $mail->FromName = "Mailer"; $mail->AddAddress("josh@example.net", "Josh Adams"); $mail->AddAddress("ellen@example.com"); $mail->AddReplyTo("info@example.com", "Information"); $mail->WordWrap = 50; $mail->AddAttachment("/var/tmp/file.tar.gz"); $mail->AddAttachment("/tmp/image.jpg", "new.jpg"); $mail->IsHTML(true); $mail->Subject = "Here is the subject"; $mail->Body = "This is the HTML message body <b>in bold!</b>"; $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"; ?> I naively assumed that it could be inserted into my script and proceeded to do so as follows ... //Mail freebies to requestors. foreach($options as $k => $value) //selected freebies { if($value){ $path_file = "$path" . $k . ".pdf"; if($mail) echo '$mailer = mailed <br>'; else echo '$mailer = not mailed <br>'; $mail->UseMSMailHeaders = true; $mail->IsSMTP(); $mail->Mailer = 'smtp'; //see www.phpfreaks.com/tutorials/130/6.ph //[NO LONGER VALID URL?] $mail->Priority = 3; $mail->Host = "ntelleck@u-sit.net"; $mail->Hostname = "smtp.u-sit.net:25"; $mail->SMTPAuth = false; $mail->SMTPDebug = false; $mail->WordWrap = 70; $mail->IsHTML(); $mail->SMTPKeepAlive = true; $mail->From = "ntelleck@u-sit.net"; $mail->FromName = "Ntelleck, LLC"; $mail->AddReplyTo ("ntelleck@u-sit.net", "Feedback"); $mail->AddAttachment("$path_file", "$k", "base64", "application/pdf"); $mail->AddAddress("$to_email", "$to_name"); $mail->Subject = "File $k is attached; ID = $invoiceNo"; $mail->Body = "Newsletter back-issue bundles are posted individually because of large file sizes"; //$mail->ClearAttachments(); if(!$mail->Send()) { mail('ntelleck@u-sit.net', "$k not sent: invoiceNo = $invoiceNo, Name: $last_name", "Mailer error: " . $mail->ErrorInfo); file_accesshttp:' } } // end of foreach However the compiler complains about two commands (so far that is, others probably await): $mail->IsSMTP(); and $mail->IsHTML(true); as shown here ... Fatal error: Call to undefined method stdClass::IsSMTP() I don’t understand the error ... ‘undefined method’ ... In the file class.phpmailer_v204.php, that is a required_once() file, require_once($_SERVER['DOCUMENT_ROOT'].'/lib/php/phpmailer/ class.phpmailer_v204.php'); is the definition, function IsSMTP() { $this->Mailer = 'smtp'; } Apparently I don’t know how to couple my specific parameter values into class.php_v204.php. Any help will be much appreciated. ens
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.