WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.8 is now available!


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.12.x) »
  • General Help & Support »
  • wbmailer problem
  • Print
Pages: [1]   Go Down

Author Topic: wbmailer problem  (Read 9424 times)

Offline crnogorac081

  • Posts: 2163
  • Gender: Male
wbmailer problem
« on: July 14, 2019, 10:38:01 PM »
Im getting this error in console when trying to send mail:

Code: [Select]
There was an uncatched exception<br />
Class 'PHPMailer' not found<br />
in line (29) of (/framework/class.wbmailer.php):<br />

wb 2.12.2. Anyone know what is happening ?
Logged
Web developer

Offline DarkViper

  • Forum administrator
  • *****
  • Posts: 3087
  • Gender: Female
Re: wbmailer problem
« Reply #1 on: July 15, 2019, 12:44:45 AM »
It looks like the PHPmailer has not been loaded.
Please follow these steps in exactly order:
  • Check if the file include/PHPMailer/PHPMailerAutoload.php exists
  • Modify Line: 31 from spl_autoload_register('PHPMailerAutoload', true, true);
    to spl_autoload_register('PHPMailerAutoload', true);
  • Check if the files class.phpmailer.php and class.smtp.php exists in the same folder.
  • Check framework/initialize.php   from line: 393
    // register PHPMailer autoloader ---------------------------------------------------------
        
    $sTmp = (\dirname(__DIR__)).'/include/PHPMailer/PHPMailerAutoload.php';
        if (!\
    function_exists('PHPMailerAutoload') && \is_readable($sTmp)) {
            include 
    $sTmp;
        }
If there are any uncertainties at points 1, 2 or 3, then re-upload the directory include/PHPMailer/.
If all these points are in order, the error should normally be resolved.

Logged
Der blaue Planet - er ist nicht unser Eigentum - wir haben ihn nur von unseren Nachkommen geliehen

"We need education to cope with digitalization - and NOT the digitalization of education.!"

Tägliches Stoßgebet: Oh Herr, wirf Hirn vom Himmel !

Offline crnogorac081

  • Posts: 2163
  • Gender: Male
Re: wbmailer problem
« Reply #2 on: July 15, 2019, 07:25:35 PM »
I made it work, now mails are sending this is the code I am using:


Code: [Select]

$send_to_email = 'sendto@thisemail.com';

$subject = preg_replace('/[\r\n]/', '', $subject);
$htmlmessage = preg_replace('/[\r\n]/', "<br />\n", $message);
$plaintext = preg_replace(",<br />,", "\r\n", $message);
$plaintext = preg_replace(",</h.>,", "\r\n", $plaintext);
$plaintext = htmlspecialchars_decode(preg_replace(",</?\w+>,", " ", $plaintext), ENT_NOQUOTES);

    // create PHPMailer object and define default settings
    $mail = new wbmailer();

    //Server settings
    $mail->SMTPDebug = 2;                                 // Enable verbose debug output
    $mail->isSMTP();                                      // Set mailer to use SMTP
    $mail->Host = 'mail.mydomain.me';   // Specify main and backup SMTP servers
    $mail->SMTPAuth = true;                               // Enable SMTP authentication
    $mail->Username = 'info@mydomain.me';                 // SMTP username
    $mail->Password = 'mypass';                           // SMTP password
    $mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
    $mail->Port = 587;                                    // TCP port to connect to

    //Recipients
    $mail->setFrom('info@mydomain.me', 'Hello from website');

// define recipient(s)


$emails = explode(",", $send_to_email);
foreach ($emails as $recip) {
if (trim($recip) != '')
$mail->AddAddress(trim($recip));                      // TO:
}


    $mail->addReplyTo('info@mydomain.me', 'Info');

    //Content
    $mail->isHTML(true);                                  // Set email format to HTML
    $mail->Subject = $subject;
    $mail->Body    = $htmlmessage;
    $mail->AltBody = $plaintext;

    $mail->send();

The mails are sending but I am recieving this error in error log:

/*code removed*/

I would like to get rid of errors in the log..
« Last Edit: July 16, 2019, 03:43:55 PM by Boudi »
Logged
Web developer

Offline jacobi22

  • Betatester
  • **
  • Posts: 5921
Re: wbmailer problem
« Reply #3 on: July 16, 2019, 12:24:22 PM »
Quote
220-We do not authorize the use of this system to transport unsolicited,
220 and/or bulk e-mail.

in the most cases: the sender-mail-adress is not from the same server or the smtp-server is not on this server

for example: a lot of servers sends smtp-mails only from the own adress
my domain: www.example.com
my mail: mail@example.com - works
my mail: mail@different-domain.com - works not or with hints in the log
my mail: mail@gmail.com - works not or with hints in the log

other example:
my domain: www.example.com
smtp-server: smtp.example.com - works
smtp-server: cp-uk-2.webhostbox.net - works not or with hints in the log

have you try it with "real" ssl on port 465?

also possible: too many mails in a special time limit - on my german server, only 50 mail per hour allowed

simple solution: a short connection problem to the secure server, but the log say's: connection is okay

other example ( im my - maybe "special" case)
i set my mail to ssl-only, ssl with Port: 465, tls with Port 587 is disabled
but in this case, you have a different output in the log - the script try to send a normal php-mail on port 25, if port 465 & SSL is not avaiable

Logged

Offline crnogorac081

  • Posts: 2163
  • Gender: Male
Re: wbmailer problem
« Reply #4 on: July 24, 2019, 06:26:10 PM »
I must enter
$mail->SMTPDebug = 0;
Instead

$mail->SMTPDebug = 2;

Or it will fill in my error log every time main script is triggered.
Logged
Web developer

Offline jacobi22

  • Betatester
  • **
  • Posts: 5921
Re: wbmailer problem
« Reply #5 on: July 25, 2019, 02:33:57 AM »
$mail->SMTPDebug = 0; == no output
$mail->SMTPDebug = 1; == show only errors on the client
$mail->SMTPDebug = 2; == show only errors on the server
$mail->SMTPDebug = 3; == server errors + initial connection informations
$mail->SMTPDebug = 4; == server errors + initial connection informations + even lower-level information

see https://github.com/PHPMailer/PHPMailer/wiki/SMTP-Debugging

here a solution with a own log-file
https://github.com/PHPMailer/PHPMailer/issues/911
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.12.x) »
  • General Help & Support »
  • wbmailer problem
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2