I'm trying to send email with a QR image in my PHP plugin. First I generate the qr image and save it in a new folder with a custom name.
$PNG_TEMP_DIR = dirname(__FILE__).DIRECTORY_SEPARATOR.'qr'.DIRECTORY_SEPARATOR;
$PNG_WEB_DIR = 'qr/';
include "phpqrcode/qrlib.php";
if (!file_exists($PNG_TEMP_DIR))
mkdir($PNG_TEMP_DIR);
$filename = $PNG_TEMP_DIR.'qr_' . $post_id . '_' . $num_ref . '.png';
$qr_content = '
Evento: ' . $event_title . '</br>
Nº de referencia: ' . $num_ref . '
';
QRcode::png($qr_content, $filename, QR_ECLEVEL_L, 5);
Then I have to send an email with some information and the QR image inside. I try with this:
$subject = $event_title . ' Confirmation';
$headers .= "From: WrocLoveLive" . "\r\n";
$message = '
<html>
<head></head>
<body>
<p>Enhorabuena ! Te has inscrito en el evento: ' . $event_title . ' el cual será el día ' . $event_date_ini . '</p>
<p>Tu número de referencia es: ' . $num_ref . '</p>
<p>Si deseas ver la información el evento, por favor, visita el siguiente enlace: </p>
<a href="' . $event_url . '">' . $event_url . '</a>
<p>Para acceder al evento se requerirá mostrar el siguiente código QR:</p>
<img src="http://localhost:8888/wroclovelive/wp-content/plugins/ceventmanager/admin/qr/qr_' . $post_id . '_' . $num_ref . '" alt="" />
<p>Esto es un mensaje automático, por favor no conteste</p>
</body>
</html>
';
$mail_confirm = mail($user_mail, $subject, $message, $headers);
if ($mail_confirm == true) {?>
<div class="message-pers"">
<p>Enhorabuena !! Te has suscrito correctamente en el evento</p>
</div>
<?php
}
The email is send correctly, but I can't view the image. The email is like that:
Is there someone who can help me?
Thank you so much !