发送电子邮件的 SMTP 与 PHP 认证
zh:发送电子邮件的 SMTP 与 PHP 认证
he:שלחו מייל עם SMTP עם PHP אימות
ro:Trimite e-mail cu SMTP cu PHP autentificare
pl:Wyślij e-mail z SMTP z PHP uwierzytelniania
de:Senden Sie e-Mail mit SMTP mit Authentifizierung PHP
nl:Stuur e-mail met SMTP met PHP verificatie
it:Inviare email con SMTP con autenticazione PHP
pt:Enviar e-mail com SMTP com autenticação PHP
es:Enviar correo electrónico con SMTP con autenticación de PHP
en:Send email with SMTP with PHP authentication
ru:Отправить письмо с SMTP аутентификации PHP
ja:PHP による認証と SMTP でメールを送信します。
ar:إرسال البريد الإلكتروني مع SMTP مع مصادقة بي إتش بي
fr:Envoyer un email avec authentification SMTP avec PHP
这篇文章是从由软件进行自动翻译。你可以看到这篇文章的源代码
在共享宿主 Ikoula 的使用方面,并非能够从一个 PHP 脚本,非说是安全的我们要求 SMTP 身份验证的服务器生成发送电子邮件。
通过 PHPmailer
这里是一个代码示例使用 PHPmailer.
// exemple serveur windows ikoula
<?php
include("class.phpmailer.php");
include("class.smtp.php");
date_default_timezone_set("Europe/Paris");
$mail = new PHPMailer();
$body = "Test de PHPMailer.";
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = "mail.votredomaine.tld";
$mail->Port = 25;
$mail->Username = "votre email";
$mail->Password = "mot de passe";
$mail->From = "votre email"; //adresse d’envoi correspondant au login entré précédemment
$mail->FromName = "votre nom"; // nom qui sera affiché
$mail->Subject = "This is the subject"; // sujet
$mail->AltBody = "corps du message au format texte"; //Body au format texte
$mail->WordWrap = 50; // nombre de caractères pour le retour à la ligne automatique
$mail->MsgHTML($body);
$mail->AddReplyTo("votre mail","votre nom");
$mail->AddAttachment("./examples/images/phpmailer.gif");// pièce jointe si besoin
$mail->AddAddress("adresse destinataire 1","adresse destinataire 2");
$mail->IsHTML(true); // envoyer au format html, passer a false si en mode texte
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Le message à bien été envoyé";
}
?>
复制 /将下面的代码粘贴在您的文件和自定义下列元素 :
- $body = "Test de PHPMailer.";
- 要发送的消息的正文。它可以严重或 html 格式的文本。
- $mail->Host = "mail.votredomaine.tld";
- 将发送邮件的 SMTP 中继
- $mail->Username = "votre email";
- 您的电子邮件地址,也将用于标识 SMTP 服务器
- $mail->Password = "mot de passe";
- 您的 SMTP 密码
- $mail->From = "votre email";
- 电子邮件将显示为发件人的地址
- $mail->FromName = "votre nom";
- 发件人的名称
- $mail->Subject = "This is the subject";
- 发表主题
- $mail->AltBody = "corps du message au format texte";
- 以纯文本格式邮件的正文中
- $mail->AddReplyTo("votre mail","votre nom");
- 默认回复地址
- $mail->AddAttachment("./examples/images/phpmailer.gif");
- pièce jointe si besoin
- $mail->AddAddress("adresse 收件人 1","adresse destinataire 2");
- destinataire(s)
额外信息
当您使用脚本来发送电子邮件时,是重要的是牢记这些都是垃圾邮件发送者被滥用的第一目标。因此,至关重要的是你获得您的脚本尽可能多地。
我们的第一项建议是不使用您常用的邮箱。喜欢使用将专门为此目的地址。
如果你在联系人窗体中使用上面的代码,我们建议您添加 验证码.
这篇文章似乎你要有用 ?
开启评论自动刷新