Sending a link via email with PHPMailer

0

I'm having trouble sending a link with references by email with PHPMailer.

Can anyone help me?

    require 'phpmailer/PHPMailerAutoload.php';

    $mail = new PHPMailer;
    $mail->IsHTML(true);
    $titulo = "Parabéns! Surgiu alguém interessado no(a) ".$partner_name;
    $texto2 = "<html>";
    $texto = "Parabéns! Surgiu um pretendente para o(a) ".$partner_name.". Para ver o pretendente, clique no link baixo. <br> ".$link;
    $mail->setFrom('[email protected]', 'PetsMatch');
    $mail->addReplyTo('[email protected]', 'First Last');
    $mail->addAddress($ownerEmail, $ownerName.' '.$ownerLastName);
    //Set the subject line
    $mail->Subject = utf8_decode($titulo);
    //$mail->CharSet = 'iso-8859-1';
    $mail->Body = "
    <p>Parabéns! Surgiu um pretendente para o(a) ".$partner_name.". Para ver o pretendente, clique no link baixo. <br> <a href='<a href='https://www.eeee.com.br/php/pares.php?type=".$type."&breed=".$breed."&sex=".$sex."&city=".$city."&state=".$state.">ver</a>;
    </p>";
    //$mail->msgHTML(utf8_decode($texto2));
    //Replace the plain text body with one created manually
    $mail->AltBody = 'This is a plain-text message body';
    //Attach an image file
    //$mail->addAttachment('images/phpmailer_mini.png');

    //send the message, check for errors
    if (!$mail->send()) {
        echo "Mailer Error: " . $mail->ErrorInfo;
    } else {
        echo "Aviso de interesse enviado!";
    }
    
asked by anonymous 09.07.2015 / 18:06

1 answer

1

Apparently this is an syntax error in HTML. Repair your code:

<p>Parabéns! Surgiu um pretendente para o(a) ".$partner_name.". Para ver o pretendente, clique no link baixo. <br> 
<a href='<a href='https://www.eeee.com.br/php/pares.php?type=".$type."&breed=".$breed."&sex=".$sex."&city=".$city."&state=".$state.">ver</a>;
</p>

It has two openings of tags a one inside the other, in this excerpt:

<a href='<a href=

Change to:

$mail->Body = "<p>Parabéns! Surgiu um pretendente para o(a) {$partner_name}. ".
              "Para ver o pretendente, clique no link baixo. <br> ".
              "<a href='https://www.eeee.com.br/php/pares.php".
              "?type={$type}&breed={$breed}&sex={$sex}&city={$city}&state={$state}'>ver</a>".
              "</p>";

Always try to keep a good formatting in your code, avoiding very long lines, so it is easier to find errors.

    
09.07.2015 / 21:43