Differenze tra le versioni di "Inviare email con SMTP con autenticazione PHP"
| Riga 1: | Riga 1: | ||
| + | <span data-link_translate_it_title="Inviare email con SMTP con autenticazione PHP" data-link_translate_it_url="Inviare email con SMTP con autenticazione PHP"></span>[[:it:Inviare email con SMTP con autenticazione PHP]][[it:Inviare email con SMTP con autenticazione PHP]] | ||
<span data-link_translate_he_title="שלחו מייל עם SMTP עם PHP אימות" data-link_translate_he_url="%D7%A9%D7%9C%D7%97%D7%95+%D7%9E%D7%99%D7%99%D7%9C+%D7%A2%D7%9D+SMTP+%D7%A2%D7%9D+PHP+%D7%90%D7%99%D7%9E%D7%95%D7%AA"></span>[[:he:שלחו מייל עם SMTP עם PHP אימות]][[he:שלחו מייל עם SMTP עם PHP אימות]] | <span data-link_translate_he_title="שלחו מייל עם SMTP עם PHP אימות" data-link_translate_he_url="%D7%A9%D7%9C%D7%97%D7%95+%D7%9E%D7%99%D7%99%D7%9C+%D7%A2%D7%9D+SMTP+%D7%A2%D7%9D+PHP+%D7%90%D7%99%D7%9E%D7%95%D7%AA"></span>[[:he:שלחו מייל עם SMTP עם PHP אימות]][[he:שלחו מייל עם SMTP עם PHP אימות]] | ||
<span data-link_translate_ru_title="Отправить письмо с SMTP аутентификации PHP" data-link_translate_ru_url="%D0%9E%D1%82%D0%BF%D1%80%D0%B0%D0%B2%D0%B8%D1%82%D1%8C+%D0%BF%D0%B8%D1%81%D1%8C%D0%BC%D0%BE+%D1%81+SMTP+%D0%B0%D1%83%D1%82%D0%B5%D0%BD%D1%82%D0%B8%D1%84%D0%B8%D0%BA%D0%B0%D1%86%D0%B8%D0%B8+PHP"></span>[[:ru:Отправить письмо с SMTP аутентификации PHP]][[ru:Отправить письмо с SMTP аутентификации PHP]] | <span data-link_translate_ru_title="Отправить письмо с SMTP аутентификации PHP" data-link_translate_ru_url="%D0%9E%D1%82%D0%BF%D1%80%D0%B0%D0%B2%D0%B8%D1%82%D1%8C+%D0%BF%D0%B8%D1%81%D1%8C%D0%BC%D0%BE+%D1%81+SMTP+%D0%B0%D1%83%D1%82%D0%B5%D0%BD%D1%82%D0%B8%D1%84%D0%B8%D0%BA%D0%B0%D1%86%D0%B8%D0%B8+PHP"></span>[[:ru:Отправить письмо с SMTP аутентификации PHP]][[ru:Отправить письмо с SMTP аутентификации PHP]] | ||
Versione delle 16:07, 9 feb 2017
it:Inviare email con SMTP con autenticazione PHP
he:שלחו מייל עם SMTP עם PHP אימות
ru:Отправить письмо с SMTP аутентификации PHP
ja:PHP による認証と SMTP でメールを送信します。
ar:إرسال البريد الإلكتروني مع SMTP مع مصادقة بي إتش بي
zh:发送电子邮件的 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
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
fr:Envoyer un email avec authentification SMTP avec PHP
Il presente articolo è stato tradotto tramite un software di traduzione automatica. È possibile visualizzare l'origine articolo qui.
Nel contesto dell'uso di un Ikoula di hosting condiviso, non è possibile generare l'invio email da uno script PHP non sicuro, i nostri server che richiede l'autenticazione SMTP.
Via PHPmailer
Ecco un esempio di codice utilizzando 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é";
}
?>
Copia /Incollare il codice seguente nel file e personalizzare i seguenti elementi :
- $corpo = "Test di PHPMailer.";
- corpo del messaggio da inviare. Può essere testo lordo o in HTML.
- $posta - >Host = "mail.votredomaine.TLD ";
- Relay SMTP che invia il tuo messaggio
- $posta - >Nome utente = "il tuo indirizzo email ";
- il tuo indirizzo di posta elettronica, che verrà utilizzato anche per identificare il server SMTP
- $posta - >Password = "password ";
- votre password SMTP
- $posta - >Da = "il tuo indirizzo email ";
- Indirizzo che verrà visualizzato come mittente di posta elettronica
- $posta - >FromName = "il tuo nome ";
- nome del mittente
- $posta - >Soggetto = "Questo è l'oggetto ";
- oggetto del messaggio
- $posta - >AltBody = "corpo del messaggio in formato testo ";
- corpo del messaggio in formato testo brut
- $posta - >AddReplyTo ("la posta ","il tuo nome ");
- Indirizzo di risposta predefinito
- $mail->AddAttachment("./examples/images/phpmailer.gif");
- allegato se necessario
- $posta - >AddAddress ("Indirizzo di spedizione 1","Indirizzo di spedizione 2");
- destinatario (s)
Ulteriori informazioni
Quando si lavora con gli script per inviare messaggi di posta elettronica, è importante tenere a mente che questi sono i primi obiettivi di abuso dagli spammer. È pertanto importante che proteggere gli script per quanto possibili.
La nostra prima raccomandazione è di non utilizzare la tua casella di posta elettronica abituale. Preferisco usare un indirizzo che sarà esclusivamente per questo scopo.
Se si utilizza il codice sopra in un modulo di contatto, si consiglia di aggiungere un Captcha.
Questo articolo sembrava poter essere utile ?
Attivare l'aggiornamento automatico dei commenti