Ver Mensaje Individual
  #8 (permalink)  
Antiguo 10/06/2014, 10:46
Avatar de arcanisgk122
arcanisgk122
 
Fecha de Ingreso: junio-2010
Mensajes: 755
Antigüedad: 13 años, 11 meses
Puntos: 28
Respuesta: PHPMailer con Gmail

yo uso este:

Código PHP:
Ver original
  1. require_once("includes/phpmailer/class.phpmailer.php");
  2.   $mail = new PHPMailer();
  3.  
  4.   if (!$mail->ValidateAddress($email)){
  5.     echo'<div class="alert-box">';
  6.       echo'<span>Favor digitar um email válido.</span>';
  7.       echo'<a href="index.php">fechar</a>';
  8.     echo'</div>';
  9.   }
  10.  
  11.   $mail->IsSMTP();
  12.   $mail->SMTPAuth = true;
  13.   $mail->Host = 'smtp.gmail.com';
  14.   $mail->Port = 465;
  15.   $mail->SMTPSecure = 'ssl';
  16.   $mail->Username = "[email protected]"; // my email which I hope to receive the data inputed on the field
  17.   $mail->Password = "mypassword";
  18.  
  19.   $mail->SetFrom($email, 'Interessado'); // the email from the person who filled the form, that will be in the body of the message that I will receive
  20.   $address = "[email protected]"; // my email which I hope to receive the data inputed on the field
  21.   $mail->AddAddress($address, "Fine Design");
  22.   $mail->Subject = "Fine Design - Avise me!";
  23.   $mail->MsgHTML($email);
  24.  
  25.   if(!$mail->Send()) {
  26.     echo'<div class="alert-box">';
  27.       echo'<span>';
  28.       echo $mail->ErrorInfo;
  29.       echo '</span>';
  30.       echo'<a href="index.php">fechar</a>';
  31.     echo'</div>';
  32.   } else {
  33.     header("Location: index.php?status=thanks");
  34.   }
  35. }?>
__________________
Cooler Master Gladiator 600 - AMD PHENOM II X4 955 @ 3.5GHZ
GA-MA78GM-US2H - Super Talent 800 2GB x 2 Dual, (Unganged)
PSU Cooler Master eXtreme Power Plus 500W - Saphire R7-260OC-2GB