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_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_pt_title="Enviar e-mail com SMTP com autenticação PHP"  data-link_translate_pt_url="Enviar+e-mail+com+SMTP+com+autentica%C3%A7%C3%A3o+PHP"></span>[[:pt:Enviar e-mail com SMTP com autenticação PHP]][[pt:Enviar e-mail com SMTP com autenticação PHP]]
 
<span data-link_translate_pt_title="Enviar e-mail com SMTP com autenticação PHP"  data-link_translate_pt_url="Enviar+e-mail+com+SMTP+com+autentica%C3%A7%C3%A3o+PHP"></span>[[:pt:Enviar e-mail com SMTP com autenticação PHP]][[pt:Enviar e-mail com SMTP com autenticação PHP]]
 
<span data-link_translate_es_title="Enviar correo electrónico con SMTP con autenticación de PHP"  data-link_translate_es_url="Enviar+correo+electr%C3%B3nico+con+SMTP+con+autenticaci%C3%B3n+de+PHP"></span>[[:es:Enviar correo electrónico con SMTP con autenticación de PHP]][[es:Enviar correo electrónico con SMTP con autenticación de PHP]]
 
<span data-link_translate_es_title="Enviar correo electrónico con SMTP con autenticación de PHP"  data-link_translate_es_url="Enviar+correo+electr%C3%B3nico+con+SMTP+con+autenticaci%C3%B3n+de+PHP"></span>[[:es:Enviar correo electrónico con SMTP con autenticación de PHP]][[es:Enviar correo electrónico con SMTP con autenticación de PHP]]

Versie van 2 okt 2015 10:01

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.