Skip to content

Latest commit

 

History

History
69 lines (48 loc) · 1.75 KB

how-can-i-set-up-phpmailer-to-use-zimbra-smtp.md

File metadata and controls

69 lines (48 loc) · 1.75 KB

How can I set up PHPMailer to use Zimbra SMTP?

// plain

To set up PHPMailer to use Zimbra SMTP, the following steps should be taken:

  1. Install PHPMailer:
composer require phpmailer/phpmailer
  1. Create a new instance of PHPMailer:
$mail = new PHPMailer;
  1. Set the host and port of the Zimbra SMTP server:
$mail->Host = 'smtp.zimbra.com';
$mail->Port = 587;
  1. Set the authentication type to use:
$mail->SMTPAuth = true;
  1. Set the username and password to access the SMTP server:
$mail->Username = '[email protected]';
$mail->Password = 'password';
  1. Set the mailer type to use:
$mail->Mailer = 'smtp';
  1. Finally, send the mail:
$mail->send();

Code explanation

**

  1. composer require phpmailer/phpmailer - This command will install PHPMailer.

  2. $mail = new PHPMailer - This will create a new instance of PHPMailer.

  3. $mail->Host = 'smtp.zimbra.com' - This will set the host of the Zimbra SMTP server.

  4. $mail->Port = 587 - This will set the port of the Zimbra SMTP server.

  5. $mail->SMTPAuth = true - This will set the authentication type to use.

  6. $mail->Username = '[email protected]' - This will set the username to access the SMTP server.

  7. $mail->Password = 'password' - This will set the password to access the SMTP server.

  8. $mail->Mailer = 'smtp' - This will set the mailer type to use.

  9. $mail->send() - This will send the mail.

## Helpful links

onelinerhub: How can I set up PHPMailer to use Zimbra SMTP?