Sending email by localhost

Asked

Viewed 75 times

0

I am putting in my system in PHP Phpmail and I want to test. I use the MAMP. Does anyone know which HOST to put in to send email? In this case, the system is running locally, ie localhost.

1 answer

0

Create a php file called test for example and include the class PHPMailerAutoload.php and configure the sample 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 see if there is a php_openssl.dll within the ext php folder

create a file teste.php and put phpinfo() and check that it is enabled.

  • test and the code ran until before IF. None of the messages appeared! You have some hint?

  • check that openssl is enabled in your php.ini

  • i didn’t even find this openssl in my php.ini file. Should I add it to the file? If so, in what way?

  • Guys, I put my website on a server and I’m running phpmailer. But when I run the code, the following message appears. Fatal error: Class 'SMTP' not found in /home/petsm976/public_html/php/phpmailer/class.phpmailer.php on line 1291 Can someone help me?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.