skip to Main Content

I am successfully sending emails by using AWS PHP SDK. Is it possible to know if email is read or not by using messageId which is generated while sending.

2

Answers


  1. There is not really any "code" to share, as the vast majority is set up through AWS and they have pretty good examples / instructions already. So I’ll point for where to go.

    Basic monitoring

    You can find if delivered, bounced, been auto-responded to, or if a complaint made. And if you’re not already doing that you should as you need to keep the number of bounces/complaints under control.

    To set up:

    To clarify: this really is a must, unless you are manually monitoring your bounces.

    Your custom PHP code will be to process the message that arrives in SQS. AWS Console gives you some tools as well to simulate bounces.

        $aNotification = $msg->body;
        // Then test for specific actions, eg for a bounce
        if ($aNotification['notificationType'] == 'Bounce') {
            /*  Example Message: 
            {
              bounce: {
                bounceType: 'Permanent',
                bounceSubType: 'General',
                bouncedRecipients: [
                  {
                    emailAddress: '[email protected]',
                    action: 'failed',
                    status: '5.1.1',
                    diagnosticCode: 'smtp; 550 5.1.1 user unknown'
                  }
                ],
                timestamp: '2020-10-08T04:53:57.551Z',
                feedbackId: '01000175068f0471-e71a0ff7-f7f3-4c96-9d72-ff1526c4345a-000000',
                remoteMtaIp: '3.225.199.89',
                reportingMTA: 'dsn; a8-82.smtp-out.amazonses.com'
              },
              mail: {
                timestamp: '2020-10-08T04:53:57.000Z',
                source: '[email protected]',
                sourceArn: 'arn:aws:ses:us-east-1:285949941349:identity/[email protected]',
                sourceIp: '3.24.70.204',
                sendingAccountId: '285949941349',
                messageId: '01000175068f027d-a5d51815-af50-490a-9550-a1a8975d30f6-000000',
                destination: [ '[email protected]' ]
              }
            }
            */
    

    Advanced monitoring (including reads)

    Once you’ve set that up, the methods for "reads" can capitalise on the SNS and SQS, but requires slightly different set up on the console.

    Caveat: the ability to track reads may or may not work, but this is how you can use the tools AWS provides.

    Login or Signup to reply.
  2. If what you’re asking is how to check if the recipient has opened the email, there’s no reliable way to do this, and the method to do this unreliably isn’t something that is supported by the SDK.

    The one available method that exists to do this (again, unreliably) is to embed a URL to an image, either one that serves a visual purpose or even a single invisible pixel, such that the URL contains some unique identifier within the URL (e.g. https://www.example.com/images/single_pixel_image.jpg?id=abc123). This image would be hosted on a server that you own and you would then detect when this image is loaded from your server (i.e. the user has opened the email, triggering it to load), extract the unique identifier, and determine which email was sent associated with that identifier.

    This reason this method is unreliable, however, is that email clients do not always automatically load images, and some of those that do will either strip the identifier from the URL or will even pre-load the image before the user ever opens the email, generating a false positive.

    A sample solution would unfortunately require a fair amount of effort to create and would likely not be easy to illustrate in a simple answer format here.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search