How to send mail using php from localhost using Mamp on mac ...?

0

I'm using the mail function but I do not know how to use it or if I have to activate something and as it would be in the case of being on a real server

    
asked by Vinicio Moya Almeida 05.11.2017 в 22:49
source

1 answer

0

You can use the class phpmailer.php, I pass you a piece of code that I use to send through gmail:

require_once('class.phpmailer.php');
$mail = new PHPMailer(true); 
$mail->IsSMTP();
$mail->Mailer = "sendmail";
//-GMAIL
$mail->SMTPDebug  = 2;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl"; 
$mail->Host = "smtp.googlemail.com";
$mail->Port = 465; 
$mail->Username = "[email protected]"; 
$mail->Password = "laclave";
$mail->SetFrom('[email protected]', 'NombreRemitente');

$mail->MsgHTML($cuerpomail);
$mail->AddAddress("[email protected]", "Destinatario"); 
$mail->IsHTML(true);
$mail->Send();
$mail->ClearAddresses(); 
$mail->ClearAttachments();
    
answered by 05.11.2017 в 23:42