Integration · PHP
Send email in PHP with PHPMailer
PHPMailer handles SMTP, TLS and MIME for you.
Steps
- 1composer require phpmailer/phpmailer
- 2Configure SMTP as below.
- 3Send from your verified domain.
Connection settings
- Host
- smtp.mailerace.com
- Port
- 587 (STARTTLS) or 465 (TLS)
- Auth
- your SMTP credential
use PHPMailer\PHPMailer\PHPMailer;
$mail = new PHPMailer(true);
$mail->isSMTP();
$mail->Host = 'smtp.mailerace.com';
$mail->Port = 587;
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->SMTPAuth = true;
$mail->Username = getenv('MAILERACE_SMTP_USER');
$mail->Password = getenv('MAILERACE_SMTP_PASSWORD');
$mail->setFrom('[email protected]', 'Acme');
$mail->addAddress('[email protected]');
$mail->Subject = 'Your receipt';
$mail->Body = 'Thanks for your order!';
$mail->send();Send from PHP with confidence
Authenticated, signed and delivered from warm IPs, with a log of every message.