You need to call:
$mail = new PHPMailer(true); // with true in the parenthesis
From the documentation:
The
true
param means it will throw exceptions on errors, which we need
to catch.
More Related Contents:
- Unable to send email using Gmail SMTP server through PHPMailer, getting error: SMTP AUTH is required for message submission on port 587. How to fix?
- PHPMailer – SMTP ERROR: Password command failed when send mail from my server
- PHP on GoDaddy Linux Shared trying to send through GMAIL SMTP
- Sent mails with phpmailer don’t go to “Sent” IMAP folder
- Could not connect to SMTP host
- phpmailer send gmail smtp timeout [duplicate]
- PHPMailer error: SMTP -> ERROR: Failed to connect to server
- phpmailer – The following SMTP Error: Data not accepted
- How to check if an email address exists without sending an email?
- Sending email with PHP from an SMTP server
- Sending email with gmail smtp with codeigniter email library
- Failed to connect to mailserver at “localhost” port 25
- How to change from-address when using gmail smtp server
- php.ini & SMTP= – how do you pass username & password
- Error handling with PHPMailer
- Configure WAMP server to send email
- Phpmailer error “Could not instantiate mail function”
- When using Gmail for SMTP, can you set a different “from” address?
- Could not instantiate mail function. Why this error occurring
- File attachment with PHPMailer
- PHPMailer generates PHP Warning: stream_socket_enable_crypto(): Peer certificate did not match expected
- “Password not accepted from server: 535 Incorrect authentication data” when sending with GMail and phpMailer
- PHP mailer multiple address [duplicate]
- trying to send mail using swift mailer, gmail smtp, php
- Setting up PHPMailer with Office365 SMTP
- How to send email with SMTP in php
- phpMailer – How do you Remove Recipients
- Setting up DomainKeys/DKIM in a PHP-based SMTP client [closed]
- PHPMailer attachment, doing it without a physical file
- Add attachment through PHPMailer