Why is ses.sendRawEmail sending the email, but it is not being received?

0

I am sending an email with sendRawEmail which contains a pdf as base64 as raw message data. When using a Base64 to PDF converter in the browser, it does return the correct pdf. However, when sending the email, the console logs a success with a messageId, but the email never gets received by the user. The email is correct, verified, and not in suppression.

// Request Data
const requestUserData = async () => {
    try {
        const htmlContent = `<h1>Hello</h1>`

        pdf.create(htmlContent).toBuffer((err, buffer) => {
            if (err) return console.error(err)
            sendEmailWithAttachment(
                ['toEmail'],
                buffer.toString('base64')
            )
        })

        console.log('done')
    } catch (err) {
        console.error(err)
    }
}

// Send With Attachment
const sendEmailWithAttachment = async (emails, buffer) => {
    // Set Up Email
    const params = {
        Source: `Name <email>`, // Sender's email address
        Destinations: emails,
        RawMessage: {
            Data: buffer,
        },
    }

    ses.sendRawEmail(params, (err, data) => {
        if (err) {
            console.log('Error:', err)
        } else {
            console.log('Email sent successfully:', data)
        }
    })
}

In case it is needed, the argument being passed to buffer in sendEmailWithAtatchment() is:

JVBERi0xLjQKMSAwIG9iago8PAovVGl0bGUgKP7/KQovQ3JlYXRvciAo/v8pCi9Qcm9kdWNlciAo/v8AUQB0ACAANQAuADUALgAxKQovQ3JlYXRpb25EYXRlIChEOjIwMjMwNjE2MTgzODQwKQo+PgplbmRvYmoKMiAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovUGFnZXMgMyAwIFIKPj4KZW5kb2JqCjQgMCBvYmoKPDwKL1R5cGUgL0V4dEdTdGF0ZQovU0EgdHJ1ZQovU00gMC4wMgovY2EgMS4wCi9DQSAxLjAKL0FJUyBmYWxzZQovU01hc2sgL05vbmU+PgplbmRvYmoKNSAwIG9iagpbL1BhdHRlcm4gL0RldmljZVJHQl0KZW5kb2JqCjYgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL1BhcmVudCAzIDAgUgovQ29udGVudHMgOCAwIFIKL1Jlc291cmNlcyAxMCAwIFIKL0Fubm90cyAxMSAwIFIKL01lZGlhQm94IFswIDAgNTk1IDg0Ml0KPj4KZW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m9udCAvSGVsdmV0aWNhLUJvbGQKL0VuY29kaW5nIC9JZGVudGl0eS1ICi9EZXNjZW5kYW50Rm9udHMgWzE0IDAgUl0KL1RvVW5pY29kZSAxNSAwIFI+PgplbmRvYmoKMyAwIG9iago8PAovVHlwZSAvUGFnZXMKL0tpZHMgClsKNiAwIFIKXQovQ291bnQgMQovUHJvY1NldCBbL1BERiAvVGV4dCAvSW1hZ2VCIC9JbWFnZUNdCj4+CmVuZG9iagp4cmVmCjAgMTcKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDA5IDAwMDAwIG4gCjAwMDAwMDAxMjAgMDAwMDAgbiAKMDAwMDAwMzcwNSAwMDAwMCBuIAowMDAwMDAwMTY5IDAwMDAwIG4gCjAwMDAwMDAyNjQgMDAwMDAgbiAKMDAwMDAwMDMwMSAwMDAwMCBuIAowMDAwMDAzNTY1IDAwMDAwIG4gCjAwMDAwMDA2MDcgMDAwMDAgbiAKMDAwMDAwMDg4OSAwMDAwMCBuIAowMDAwMDAwNDIxIDAwMDAwIG4gCjAwMDAwMDA1ODcgMDAwMDAgbiAKMDAwMDAwMDkwOCAwMDAwMCBuIAowMDAwMDAxMTcyIDAwMDAwIG4gCjAwMDAwMDI4ODggMDAwMDAgbiAKMDAwMDAwMzEyMiAwMDAwMCBuIAowMDAwMDAyODY3IDAwMDAwIG4gCnRyYWlsZXIKPDwKL1NpemUgMTcKL0luZm8gMSAwIFIKL1Jvb3QgMiAwIFIKPj4Kc3RhcnR4cmVmCjM4MDMKJSVFT0YK
asked a year ago470 views
2 Answers
0

Is the e-mail address of the recipient also verified?
https://docs.aws.amazon.com/ses/latest/dg/verify-addresses-and-domains.html
If you are in a sandbox, the receiver must also be verified.

How about testing the transmission once from the management console instead of from the program?

https://docs.aws.amazon.com/ses/latest/dg/send-an-email-from-console.html

profile picture
EXPERT
answered a year ago
0

I am facing the same issue. Also tried it via the management console. Sending an email with an attachment (small pdf) to a gmail address works perfectly, but with other addresses, it fails (e.g. GMX, IONOS). Any suggestions?

Sascha
answered a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions