Stuur e-mail met SMTP met PHP verificatie: verschil tussen versies

Uit Nl Ikoula wiki
Jump to navigation Jump to search
Regel 1: Regel 1:
 +
<span data-link_translate_zh_title="发送电子邮件的 SMTP 与 PHP 认证"  data-link_translate_zh_url="%E5%8F%91%E9%80%81%E7%94%B5%E5%AD%90%E9%82%AE%E4%BB%B6%E7%9A%84+SMTP+%E4%B8%8E+PHP+%E8%AE%A4%E8%AF%81"></span>[[:zh:发送电子邮件的 SMTP 与 PHP 认证]][[zh:发送电子邮件的 SMTP 与 PHP 认证]]
 
<span data-link_translate_ro_title="Trimite e-mail cu SMTP cu PHP autentificare"  data-link_translate_ro_url="Trimite+e-mail+cu+SMTP+cu+PHP+autentificare"></span>[[:ro:Trimite e-mail cu SMTP cu PHP autentificare]][[ro:Trimite e-mail cu SMTP cu PHP autentificare]]
 
<span data-link_translate_ro_title="Trimite e-mail cu SMTP cu PHP autentificare"  data-link_translate_ro_url="Trimite+e-mail+cu+SMTP+cu+PHP+autentificare"></span>[[:ro:Trimite e-mail cu SMTP cu PHP autentificare]][[ro:Trimite e-mail cu SMTP cu PHP autentificare]]
 
<span data-link_translate_pl_title="Wyślij e-mail z SMTP z PHP uwierzytelniania"  data-link_translate_pl_url="Wy%C5%9Blij+e-mail+z+SMTP+z+PHP+uwierzytelniania"></span>[[:pl:Wyślij e-mail z SMTP z PHP uwierzytelniania]][[pl:Wyślij e-mail z SMTP z PHP uwierzytelniania]]
 
<span data-link_translate_pl_title="Wyślij e-mail z SMTP z PHP uwierzytelniania"  data-link_translate_pl_url="Wy%C5%9Blij+e-mail+z+SMTP+z+PHP+uwierzytelniania"></span>[[:pl:Wyślij e-mail z SMTP z PHP uwierzytelniania]][[pl:Wyślij e-mail z SMTP z PHP uwierzytelniania]]

Versie van 18 nov 2015 15:15

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 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 fr:Envoyer un email avec authentification SMTP avec PHP

Dit artikel is vertaald door middel van automatische vertalingssoftware. U kunt het artikel bron hier te bekijken.





In het kader van het gebruik van een gedeelde hosting Ikoula is het niet mogelijk om te verzenden e-mail genereren vanuit een PHP script niet-beveiligde, onze servers SMTP-verificatie vereisen.

Via PHPmailer

Hier is een voorbeeld van code met behulp van 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é";
  } 
?>

Kopie /Plak de onderstaande code in uw bestand en de volgende elementen aanpassen :

$lichaam = "PHPMailer test.";
hoofdtekst van het bericht te verzenden. Kan het tekst bruto of in HTML.
$mail - >Host = "mail.votredomaine.TLD ";
SMTP-relay die je bericht stuurt
$mail - >Gebruikersnaam = "uw e-mailadres ";
uw e-mailadres, die zal ook worden gebruikt om de SMTP-server te identificeren
$mail - >Wachtwoord = "wachtwoord ";
votre wachtwoord SMTP
$mail - >Van = "uw e-mailadres ";
e-mailadres dat wordt weergegeven als afzender
$mail - >FromName = "uw naam ";
naam van afzender
$mail - >Onderwerp = "Dit is het onderwerp ";
onderwerp
$mail - >AltBody = "hoofdtekst van het bericht in tekstformaat ";
hoofdtekst van het bericht in tekstformaat brut
$mail - >AddReplyTo ("uw e-mailberichten ","uw naam ");
standaard antwoordadres
$mail->AddAttachment("./examples/images/phpmailer.gif");
bijlage indien nodig
$mail - >AddAddress ("Verzendadres 1","Verzendadres 2");
ontvanger (s)

Extra informatie

Wanneer u met scripts om e-mail te verzenden werkt, is het belangrijk te bedenken dat dit het eerste doelwit van misbruik door spammers zijn. Het is daarom belangrijk dat u uw scripts zoveel mogelijk beveiligen.

Onze eerste aanbeveling is om geen gebruik van uw gebruikelijke mailbox. Liever met een adres dat uitsluitend voor dit doel worden zal.

Als u de bovenstaande code in een contact formulier, is het aan te raden dat u toevoegen een CAPTCHAs.




Dit artikel leek u nuttig ?

0



U mag niet reageren.