Skip to content

Instantly share code, notes, and snippets.

@evilnapsis
Forked from anonymous/send.php
Created February 24, 2017 03:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evilnapsis/5bb5323560636ee295cb9e79af10432e to your computer and use it in GitHub Desktop.
Save evilnapsis/5bb5323560636ee295cb9e79af10432e to your computer and use it in GitHub Desktop.
Codigo para enviar correos con gmail y la libreria phpmailer.php
<?php
include "class.phpmailer.php";
include "class.smtp.php";
$email_user = "TU_EMAIL";
$email_password = "TU_PASSWORD";
$the_subject = "Phpmailer prueba by Evilnapsis.com";
$address_to = "evilnapsis@gmail.com";
$from_name = "Evilnapsis";
$phpmailer = new PHPMailer();
// ---------- datos de la cuenta de Gmail -------------------------------
$phpmailer->Username = $email_user;
$phpmailer->Password = $email_password;
//-----------------------------------------------------------------------
// $phpmailer->SMTPDebug = 1;
$phpmailer->SMTPSecure = 'ssl';
$phpmailer->Host = "smtp.gmail.com"; // GMail
$phpmailer->Port = 465;
$phpmailer->IsSMTP(); // use SMTP
$phpmailer->SMTPAuth = true;
$phpmailer->setFrom($phpmailer->Username,$from_name);
$phpmailer->AddAddress($address_to); // recipients email
$phpmailer->Subject = $the_subject;
$phpmailer->Body .="<h1 style='color:#3498db;'>Hola Mundo!</h1>";
$phpmailer->Body .= "<p>Mensaje personalizado</p>";
$phpmailer->Body .= "<p>Fecha y Hora: ".date("d-m-Y h:i:s")."</p>";
$phpmailer->IsHTML(true);
$phpmailer->Send();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment