Sono nuovo su php. Stavo cercando di inviare mail da php usando questo codice.php invia mail da localhost
<?php
$to = '[email protected]';
$subject = 'The subject';
$message = 'hello';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
devo modificare le impostazioni in php.ini
[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 = [email protected]
& in sendmail.ini
# A freemail service example
account Gmail
tls on
tls_certcheck off
host smtp.gmail.com
from [email protected]
auth on
user [email protected]
password xxxxxxxxx
# Set a default account
account default : Gmail
Ora codice viene eseguito con successo, ma io non sto ottenendo alcuna mail.
È necessario installare il server di posta su localhost. [PHPMailer] (http://sourceforge.net/projects/phpmailer/) – Bora
@Bora: Penso che sia possibile aggiungere il server di posta smmail o gmail o yahoo. Non è vero? –
o utilizzare un server smtp remoto, come GMAIL –