500 internal error

Hello everybody,
my website have a bug showing http error 500!

I have verified error log on my server it tells this:

[25-Sep-2016 16:23:17] PHP Fatal error:  Uncaught exception 'phpmailerException' with message 'Invalid address: ' in /home2/dzairtro/public_html/wp-includes/class-phpmailer.php:946
Stack trace:
#0 /home2/dzairtro/public_html/wp-includes/pluggable.php(352): PHPMailer->setFrom('', 'WordPress', false)
#1 /home2/dzairtro/public_html/wp-content/themes/classifieds/functions.php(4857): wp_mail()
#2 /home2/dzairtro/public_html/wp-includes/plugin.php(524): classifieds_send_expire_notice('admin@dzairtroc...', '', '', Array)
#3 /home2/dzairtro/public_html/wp-settings.php(411): do_action('')
#4 /home2/dzairtro/public_html/wp-config.php(91): require_once('/home2/dzairtro...')
#5 /home2/dzairtro/public_html/wp-load.php(39): require_once('/home2/dzairtro...')
#6 /home2/dzairtro/public_html/wp-blog-header.php(13): require_once('/home2/dzairtro...')
#7 /home2/dzairtro/public_html/index.php(17): require('/home2/dzairtro...')
#8 {main}
  thrown in /home2/dzairtro/public_html/wp-includes/class-phpmailer.php on line 946

Can you help me to solve it!!

Regards,
Neskit

Well according to your exception message you have an invalid address. Without seeing your code its hard to say exactly what is wrong.

Also you should catch that exception with a try and catch or use the exception handler to catch uncaught exceptions.

Hi jgetner,
should I modify all the files listed in error report
where can I find the code of invalid adress
here is the code of the file: class- phpmailer.php where main error is:

  public function setFrom($address, $name = '', $auto = true)
    {
        $address = trim($address);
        $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim
        // Don't validate now addresses with IDN. Will be done in send().
        if (($pos = strrpos($address, '@')) === false or
            (!$this->has8bitChars(substr($address, ++$pos)) or !$this->idnSupported()) and
            !$this->validateAddress($address)) {
            $error_message = $this->lang('invalid_address') . $address;
            $this->setError($error_message);
            $this->edebug($error_message);
            if ($this->exceptions) {
                throw new phpmailerException($error_message);
            }
            return false;
        }
        $this->From = $address;
        $this->FromName = $name;
        if ($auto) {
            if (empty($this->Sender)) {
                $this->Sender = $address;
            }
        }
        return true;
    }

the line shown in error log is line : throw new phpmailerexception…

Thank you

I don’t imagine many of your files involve sending out emails.

eg.
the “contact us” page / widget
the error handler if you have it set up to send you emails
a cron job that sends you reports

Hello guys,
The issue was solved, it was a matter of core files! I have contacted the hosting provider and they replaced the core files for me

Thank you for your help

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.