Search code examples
c++gmail-imap

Gmail issue - sending email through c++


Updated: This problem is solved. The "RCPT" field format not correct as state by @Botje and @Remy Lebeau

I am sending an email using a C++ program through Gmail (smtp.gmail.com). However, I encounter some strange issues when sending emails to multiple recipients; only the first recipient receives the email.

Based on the communication log, Gmail's server accepts the email without returning any errors. The address format also complies with Gmail standards. Do you have any ideas or suggestions regarding this issue?

Communication log

image

I expected that all recipients would receive the email.

I thought there might be null-terminated characters in between, so I tried looping through all the strings to ensure there were no null-terminated characters. However, I still encountered the same issues. I also attempted passing all recipients as a list, but the problem persisted.

Additionally, I verified that it's not a recipients issue by swapping the recipients’ email addresses, and the result remained the same. Only the first recipient received the email.


Solution

  • RFC 5321, 4.1.1.3 states:

    RCPT: multiple recipients are specified by multiple uses of this command.

    You only have a single RCPT TO:.