drips / 邮件

基于 PhpMailer 的 PHP 邮件系统

v1.0.0 2016-07-22 14:44 UTC

This package is not auto-updated.

Last update: 2024-09-26 00:11:42 UTC


README

Build Status Code Climate Test Coverage Latest Release

描述

基于 PHPMailer 的邮件发送器。

配置

  • mail_smtp - 指定是否使用 SMTP 服务器 (true/false)
  • mail_smtp_host - SMTP 主机
  • mail_smtp_auth - 指定是否需要认证 (true/false)
  • mail_smtp_username - 用户名
  • mail_smtp_password - 密码
  • mail_smtp_secure - 加密
  • mail_smtp_port - 端口
  • mail_from_email - (可选) 默认发送电子邮件的电子邮件地址
  • mail_from_name - (可选) 显示的发送者名称
  • mail_cc - (可选) 发送到多个收件人的邮件副本
  • mail_bcc - (可选) 邮件的盲抄本

示例

<?php

use Drips\Mail\Mail;

$mail = new Mail;

$mail->addAddress('test@prowect.com', 'Test'); // Empfänger hinzufügen (zweiter Parameter ist optional);
$mail->addReplyTo('test@prowect.com', 'Test'); // Empfänger der Antwort-Email
$mail->addAttachment('/test/image.png'); // Anhang hinzufügen
$mail->isHTML(true); // HTML Email Format

$mail->Subject = 'Here is the subject'; // Betreff
$mail->Body = 'This is the body for HTML mail clients'; // Nachricht
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; // Alternativ wenn HTML nicht unterstützt wird

if(!$mail->send()) {
    // Email konnte nicht gesendet werden
} else {
    // Email wurde erfolgreich gesendet
}