Tracking Openings on Transactional emails

assuncao

Member
Hi guys,

I have created a page to colect IP and location_id to add to an image into the body of the message. It stores in a new table. I also created an API to view these data. Everything is working fine, I just need to add the image (with the email_uid) to the body. I'm sending transactionals emails via API, so basically what I do is:

PHP:
        $response = $endpoint->create(array(
            'to_name'           => $post['to_name'], // required
            'to_email'          => $post['to_email'], // required
            'from_name'         => $post['from_name'], // required
            'from_email'        => $post['from_email'], // optional
            'reply_to_name'     => $post['reply_to_name'], // optional
            'reply_to_email'    => $post['reply_to_email'], // optional
            'subject'           => $post['subject'], // required
            'body'              => $post['body'], // required
            'plain_text'        => $post['plain_text'], // optional, will be autogenerated if missing
            'send_at'           => date('Y-m-d H:i:s',strtotime("-1 days")),  // required, UTC date time in same format!
        ));

I would like to understand how does MW add the tracking image to the email. I didn't find it to copy. Does anyone know how? Thank you!
 
@assuncao - that's simple, from php you can do it as simple as:
PHP:
$html = str_replace('</body>', '<img src="..."/></body>', $html);
So you just inject it at the end of the document before the body tag closes.
 
Back
Top