本文整理汇总了PHP中mailer::AddReplyTo方法的典型用法代码示例。如果您正苦于以下问题:PHP mailer::AddReplyTo方法的具体用法?PHP mailer::AddReplyTo怎么用?PHP mailer::AddReplyTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mailer
的用法示例。
在下文中一共展示了mailer::AddReplyTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: html
function html($to, $toName, $from, $fromName, $subject, $body)
{
$mail = new mailer();
if (defined('mail_from')) {
$mail->From = mail_from;
$mail->AddReplyTo($from, $fromName);
} else {
$mail->From = $from;
}
$mail->FromName = $fromName;
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->Body = $body;
switch (gettype($to)) {
case 'string':
$mail->AddAddress($to, $toName);
break;
case 'array':
foreach ($to as $toKey => $thisTo) {
$mail->AddAddress($thisTo, $toName[$toKey]);
}
break;
default:
trigger_error('invalid type for address field');
}
if (!$mail->Send()) {
trigger_error("Message could not be sent. Mailer Error: " . $mail->ErrorInfo);
}
}
示例2: exec
public function exec($data)
{
$response_array = array();
$name = ucwords($data['name']);
$email = $data['email'];
$phone = $data['phone'] != "" ? $data['phone'] : "-";
$message = $data['message'];
// NOTIFY RECEIVER BY EMAIL
// Generate Email BODY
$html = file_get_contents(BASE_PATH . 'email_template/contact');
$html = htmlspecialchars($html);
$html = str_replace('[NAME]', $name, $html);
$html = str_replace('[EMAIL]', $email, $html);
$html = str_replace('[PHONE]', $phone, $html);
$html = str_replace('[MESSAGE]', $message, $html);
$html = html_entity_decode($html);
$body = $html;
// Send Email
$mailer = new mailer();
$mailer->IsSMTP();
// set mailer to use SMTP
$mailer->Port = EMAIL_PORT;
$mailer->Host = EMAIL_HOST;
// specify main and backup server
$mailer->SMTPAuth = true;
// turn on SMTP authentication
$mailer->Username = NOREPLY_EMAIL;
// SMTP username
$mailer->Password = NOREPLY_PASS;
// SMTP password
$mailer->From = NOREPLY_EMAIL;
$mailer->FromName = SUPPORT_NAME;
$mailer->AddReplyTo($email, $name);
$mailer->AddAddress(CONTACT_EMAIL);
$mailer->IsHTML(true);
$mailer->Subject = "NEW message from {$email} via 1STG Contact Form.";
$mailer->Body = $body;
if (!$mailer->Send()) {
$response_array['r'] = "false";
$response_array['msg'] = "Technical Error: " . $mailer->ErrorInfo;
} else {
$response_array['r'] = "true";
$response_array['msg'] = "Your message has been successfully submit.";
}
return $response_array;
}