Email to external domains

1

I need help to send an email with an html design in php mailer , the fact is that I send my recipient email to an external server (not to gmail, or to hotmail, etc.), when sending it , all the html document is outdated and does not arrive as it should, in the case of gmail and hotmail arrives super well, I do not know if it is a problem of the recipient mail server or I am doing something wrong.

Annex the code:

<html>
 <p>$mail = new PHPMailer;   // se crea el objeto mail</p>
  <p>  $mail->isSMTP(); /// se activa smtp</p>
    <p>$mail->CharSet = 'UTF-8';</p>
    <p>$mail->SMTPDebug = 0;</p>
    <p>$mail->Debugoutput = 'html';</p>
    <p>$mail->Host = 'smtp.gmail.com'; /// servidor de correo de salida</p>
    <p>$mail->SMTPAuth = true; /// validar authentication</p>
    <p>mail->Username = '[email protected]'; /// correo de salida</p>
    <p>$mail->Password = 'XXXXXXX'; //Contraseña</p>
    <p>$mail->Port = 25; ///salida del puerto</p>
    <p>$mail->setFrom('[email protected]', 'Fes');   //// correo de salida</p>
    <p>$mail->addAddress('[email protected]', 'Pedido'); /// correo a ventas</p>
    <p>$mail->isHTML(true); // Set email format to HTML</p>
    <p>$mail->Subject = 'Pedido tienda Online'; // Asunto</p>
    $mail->Body  = "<html>Aqui va todo el diseño</p>
    </html>";
</html>
    
asked by Juan Carlos Hervert 12.07.2018 в 00:15
source

2 answers

0

I also occupy PHPMailer but the SMTP sent that I occupy is the default server where I have installed this, maybe I can serve you as I do.

    $asunto = "Cotización de " . $sucursal;
    $mail = new PHPMailer(); // defaults to using php "mail()"
    $mail->SetFrom($correo, $empresa);
    $address = $correo_cliente;// Aqui va el correo del cliente "N"
    $mail->AddAddress($address, $nombre_cliente);
    $mail->addCC($correo_empresa_gerencia);//copia aun correo especifico
    //Por si decido mandar copia a varios correos
    foreach ($mailres as $key => $value) {
        $mail->addCC($value);
        echo $value;
    }
    $mail->addCC($correo);
    $mail->Subject = utf8_decode($asunto);
    $mail->MsgHTML(utf8_decode($email)); //Aqui mando el HTML del correo.
    $mail->AddAttachment($namecotizacion); // Aqui adjunto la cotizacion.
    if ($mail->Send()) {
        $msjEnvio = "El mensaje se envio con exito";
    }
    
answered by 12.07.2018 / 01:05
source
1

That I know should go this way.

$html = "<html>
          <p>Todo el codigo html que quieras</p>
        </html>";
$mail = new PHPMailer;   // se crea el objeto mail
$mail->isSMTP(); /// se activa smtp
$mail->CharSet = 'UTF-8';
$mail->SMTPDebug = 0;
$mail->Debugoutput = 'html';
$mail->Host = 'smtp.gmail.com'; /// servidor de correo de salida
$mail->SMTPAuth = true; /// validar authentication
mail->Username = '[email protected]'; /// correo de salida
$mail->Password = 'XXXXXXX'; //Contraseña
$mail->Port = 25; ///salida del puerto
$mail->setFrom('[email protected]', 'Fes');   //// correo de salida
$mail->addAddress('[email protected]', 'Pedido'); /// correo a ventas
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Pedido tienda Online'; // Asunto
$mail->Body  = $html;
    
answered by 12.07.2018 в 00:28