Domini - Rubalo.it registrazione domini e spazio web hosting e server                                 Pensa a un dominio:    
Cerca:     Ricerca avanzata
Sfoglia per categorie:
Invia articolo

Invio Email dal sito (con PhpMailer per php5)

Visite: 1183
Posted: 23 gen, 2010
by: Admin A.
Updated: 06 apr, 2010
by: Admin A.

<?php

function sendMail($from, $subject, $body, $to, $debug, $attach){
require_once("include/mailPx/class.phpmailer.php");
  $mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
  if($debug){
    //require_once("class.smtp.php");
    try {
  $mail->IsSMTP();  
  $mail->SMTPDebug  = 2;   // enables SMTP debug information (for testing)
                                 // 1 = errors and messages
                                // 2 = messages only
  $mail->SMTPAuth   = true;                  // enable SMTP authentication
  $mail->Host       = "mail.DOMINIO"; // sets the SMTP server
  $mail->Port       = 25;                    //  
  $mail->Username   = "admin@DOMINIO"; // SMTP account username
  $mail->Password   = "PASSWORD";        // SMTP account password
  $mail->AddReplyTo($from, 'DOMINIO');
  $mail->AddAddress($to, 'Gentile Cliente');
  $mail->SetFrom($from, 'DOMINIO');
  $mail->Subject = $subject;
  $mail->AltBody = strip_tags(str_replace('<br>','\n',$body)); // optional - MsgHTML will create an alternate automatically
  $mail->MsgHTML($body);
  $mail->IsHTML(true);
  if($attach!=""){
   $mail->AddAttachment($attach);
  }
  $mail->Send();
  echo "ok";
  } catch (phpmailerException $e) {
   echo $e->errorMessage(); //Pretty error messages from PHPMailer
  } catch (Exception $e) {
   echo $e->getMessage(); //Boring error messages from anything else!
  }
 
}
}
sendMail("admin@Dominio.ext", "XXXXXXX: soggetto", "messaggio<br>xxxxxxxxx", "emaildestinatario@dominiodestinatario", 1 ,'');

?>
Altro in questa categoria
document Che cosa significa "hosting" ?
document Che differenza c'e' tra Windows e Linux?
document Pubblicazione dei siti web tramite FTP
document Pubblicazione tramite frontpage
document Ho acquistato uno piano hosting da Rubalo.it , posso utilizzare tale spazio per un’altro nome a dominio?
document Se ho spazio web presso altri provider o su un mio server , posso utilizzarli per un dominio registrato presso RUBALO.IT?
document Attivare un database mysql
document Qual è lo spazio assegnato al mio db mysql
document Cosa significa ‘query’ ?
document Ho raggiunto il limite di query giornaliere per il db mysql, è possibile aumentarle?
document Come si effettua l'upload dei files via PHP?
document Recuperare i dati di accesso per la gestione del dominio/hosting
document Come posso scaricare l'Emmeblog?
document Procedura di attivazione e personalizzazione dell'Emmeblog
document Formmail
document Connessione Database MySQL tramite l’uso di ASP
document LAR
document Cdosys, formMail in asp per Hosting Windows Rubalo.it
document Esempio di utilizzo di client ftp per la pubblicazione del sito web
document protezione di cartelle con .htaccess
document Invio email dal sito web (per hosting linux)
document E’possibile utilizzare PEAR per l’autenticazione email su hosting linux?
document Utilizzo di Joomla su server Linux
document DOCUMENT_ROOT su server Windows



RSS