Sending email by localhost [duplicate]

0

I'm putting PHPMail on my system in PHP and I want to test it. I use MAMP. Does anyone know which HOST one should put up to send email? In case the system is being run local, ie localhost.

    
asked by anonymous 26.06.2015 / 22:33

1 answer

0

Create a php file called test for example and include the class PHPMailerAutoload.php and set the example parameters:




date_default_timezone_set('Etc/UTC');

require 'PHPMailerAutoload.php';

$mail = new PHPMailer;

$mail->isSMTP();

$mail->SMTPDebug = 0;
$mail->Debugoutput = 'html';
$mail->Host = 'smtp.mail.yahoo.com.br'; // SMTP DO SEU EMAIL
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = "[email protected]"; // SEU EMAIL
$mail->Password = "SuaSenha"; // SUA SENHA
$mail->setFrom('[email protected]', 'Seu nome');
$mail->addReplyTo('[email protected]', 'Reply');
$mail->addAddress('[email protected]', 'NomeDestinatario');
$mail->Subject = 'Titulo do Texto do Teste';
$mail->Body = 'Mensagem de texto DO Teste';

if (!$mail->send()) {
   echo "Ocorreu algum problema e não conseguimos entregar o seu email: " . $mail->ErrorInfo;
} else {
   echo "Mensagem enviada!";
}

add openssl

First go to your php.ini and put:

[PHP_OPENSSL]
extension=php_openssl.dll

and look for php_openssl.dll inside the php ext folder

create a file teste.php and put phpinfo() and make sure it is enabled.

    
26.06.2015 / 22:57