I am using Gmail API via PHP.
I am sending messages, and they bounce with:
"There was an error. Email was not sent."
But it does not mention the error.
How can I debug this situation?
I think the problem is in my message itself.
From: =?utf-8?B?VGF0aWFuYSBUb3JyZXMgTW9udGVybw==?= <...@gmail.com>
To: <...@gmail.com>
Subject: =?utf-8?B?TUlSQU1JUEVORQ==?=
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="_Part_150598468959c380b160a341.92104241"
--_Part_150598468959c380b160a341.92104241
Content-Type: multipart/alternative; boundary="_Part2_150598468959c380b160a514.30698822"
--_Part2_150598468959c380b160a514.30698822
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: base64
VHJhbmNhcyB5IGJhcnJhbmNhcyZyYXF1bzsgRW52aWFkbyBkZXNkZSBub21icmVBcHBhRGVjaWRpcg==
--_Part2_150598468959c380b160a514.30698822
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: base64
HDYd...
--_Part2_150598468959c380b160a514.30698822--
--_Part_150598468959c380b160a341.92104241
Content-Transfer-Encoding: base64
Content-Type: {image/jpeg}; name=una-imagen-adjunta.png;
Content-Disposition: attachment; filename=una-imagen-adjunta.png;
HGstdfwcy...
--
I tried Transfer-Encoding the text and html part with 7bit and 8bit too. But none of them is working, and I like more base64 so I stick with it for all parts.
Gmail API answer after sending:
object(Google_Service_Gmail_Message)#56 (14) { ["collection_key":protected]=> string(8) "labelIds" ["historyId"]=> NULL ["id"]=> string(16) "15ea3bd3e05c8509" ["internalDate"]=> NULL ["labelIds"]=> array(1) { [0]=> string(4) "SENT" } ["payloadType":protected]=> string(32) "Google_Service_Gmail_MessagePart" ["payloadDataType":protected]=> string(0) "" ["raw"]=> NULL ["sizeEstimate"]=> NULL ["snippet"]=> NULL ["threadId"]=> string(16) "15ea3bd3e05c8509" ["internal_gapi_mappings":protected]=> array(0) { } ["modelData":protected]=> array(0) { } ["processed":protected]=> array(0) { } }
Note: I can see the mail in the sent folder, with correct body and attached files.
And the bounce:
English: Email not sent. Error.
I do not know how to find the cause of this error, not even where to start.
Note: My API quota is alright, I do not use even 5% of daily quota.
Thank you.