Originariamente inviata da
boots
Codice PHP:
if($mail->Send()){
echo "Email inviata";
}else{
echo "Email non inviata";
}
PS:Tieni presente che phpmailer usa il client di posta impostato sul server (apache o altro), quindi controlla che sia presente ed impostato
Codice PHP:
$doc = $p->Output('S');
// invio dell'email
$mail = new PHPMailer();
$mail->From = 'mittente@sito.it';
$mail->FromName = 'Eliox';
$mail->Subject = 'Allegato in PDF';
$mail->Body = 'Apri il file in allegato';
$mail->AddAddress('destinatario@sito.it');
// definizione dell'allegato
$mail->AddStringAttachment($doc, 'doc.pdf', 'base64', 'application/pdf');
// spedizione
//$mail->Send();
if($mail->Send()){
echo "Email inviata";
}else{
echo "Email non inviata";
}
//ob_end_flush();
?>
entra correttamente nell'if ed esegue il secondo echo
Sul server dove gira l'applicazione ho scaricato e configurato hMailServer, ma niente da fare...
Questo il php.ini modificato sul server
codice:
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP=localhost
; http://php.net/smtp-port
smtp_port=25
; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = me@example.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
;sendmail_path =
; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail().
;mail.force_extra_parameters =
; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header=On
; The path to a log file that will log all mail() calls. Log entries include
; the full path of the script, line number, To address and headers.
;mail.log =
; Log mail to syslog (Event Log on Windows).
;mail.log = syslog