Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/06/2006, 15:21
jossxx
 
Fecha de Ingreso: marzo-2003
Mensajes: 225
Antigüedad: 21 años, 1 mes
Puntos: 0
phpmailer y MySQL

Tengo un servidor linux, mysql y sevidor smtp y estoy probando phpmailer y no funciona cuando busca los correos en MySQL, no da error pero no llegan.
El scripts es de la página de phpmailer así que obviamente está bien.

Tengo algunas dudas:
- en la conexión con MySQL el host es dominio.es o localhost?
- de donde sale la variable de WHERE Id=$Id?
- es necesario incluir $mail->IsSMTP();?

y este es el script:

Código PHP:
require("class.phpmailer.php");

$mail = new PHPMailer();

$mail->From     "[email protected]";
$mail->FromName "List manager";
$mail->Host     "smtp1.site.com;smtp2.site.com";
$mail->Mailer   "smtp";

@
MYSQL_CONNECT("localhost","root","password");
@
mysql_select_db("my_company");
$query  "SELECT full_name, email, photo FROM employee WHERE id=$id";
$result = @MYSQL_QUERY($query);

while (
$row mysql_fetch_array ($result))
{
    
// HTML body
    
$body  "Hello <font size=\"4\">" $row["full_name"] . "</font>, <p>";
    
$body .= "<i>Your</i> personal photograph to this message.<p>";
    
$body .= "Sincerely, <br>";
    
$body .= "PHPMailer List manager";

    
// Plain text body (for mail clients that cannot read HTML)
    
$text_body  "Hello " $row["full_name"] . ", \n\n";
    
$text_body .= "Your personal photograph to this message.\n\n";
    
$text_body .= "Sincerely, \n";
    
$text_body .= "PHPMailer List manager";

    
$mail->Body    $body;
    
$mail->AltBody $text_body;
    
$mail->AddAddress($row["email"], $row["full_name"]);
    
$mail->AddStringAttachment($row["photo"], "YourPhoto.jpg");

    if(!
$mail->Send())
        echo 
"There has been a mail error sending to " $row["email"] . "<br>";

    
// Clear all addresses and attachments for next loop
    
$mail->ClearAddresses();
    
$mail->ClearAttachments();