Closed cdtweb closed 7 years ago
@cdtweb Sorry that you are facing this problem. Can you verify that the base64_encode($raw_message)
is not empty. Also, do you receive any errors when you send the message.
For reference this is the documentation for sendRawEmail-> http://docs.aws.amazon.com/aws-sdk-php/v3/api/api-email-2010-12-01.html#sendrawemail
@imshashank I can verify that the result of base64_encode($raw_message)
is the base64 encoded message. I also tested that the encoded message, when decoded, is the exact same as the raw message (as it should be).
I am receiving a warning but I haven't been able to figure out how it is related:
Warning: A non-numeric value encountered in ../vendor/aws/aws-sdk-php/src/Api/Serializer/QueryParamBuilder.php on line 108
Thank you for posting that link. However, I have already gone over it several times and still haven't been able to get it to work.
@cdtweb Hi, I tested the sesClient
and sent myself a raw message. I was able to see the string passed as body in rawEmail, in the email I received in my inbox.
Can you please confirm that you are correctly forming the body of the message. Please have a look at the SES guide for sending the raw email.
http://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-email-raw.html
I would recommend having a look at the sendEmail
method [http://docs.aws.amazon.com/aws-sdk-php/v3/api/api-email-2010-12-01.html#sendemail]. It will take care of setting header/body/etc parameters.
Please let me know if this doesn't resolve your issue.
@imshashank I believe that my message body is formatted correct. When I use AWS SDK for PHP v2 I can send the email and it comes through in my mailbox exactly as intended. Using the exact same message body, with AWS SDK for PHP v3, the email is getting delivered, but everything is missing except for the "From:" address. It is very strange as there is no difference between the calls other than the SDK version.
As far as using sendEmail
I was under the impression that I could not send attachments. Do you have an example on how I could send an attachment with this method?
@cdtweb I was able to figure out the difference in v2 and v3 of PHP SDK in method sendRawEmail
.
in V2, the field data
needs to be base64 encoded. This is what the field would look like-> 'RawMessage' => [ 'Data' => base64_encode($msg)]
.
But In v3, the field 'RawMessage' => [ 'Data' => $msg ]
doesn't need to be base64 encoded as the v3 SDK will take care of it and encode the data
attribute before sending to service endpoint.
Sorry for the confusion, we will update our docs to better reflect this. Thanks a lot for bringing this to our notice.
Please let us know and update this thread to verify if this resolves your issue.
@imshashank It does work. Thank you very much for your help!
@cdtweb Closing this issue and adding a task to backlog to update docs for SESClient sendRawEmail
.
Hi, I recently upgraded to AWS SDK v3 for one of my projects and I'm having an issue sending a raw email with and without an attachment. The email is getting delivered, but everything is missing except for the "From:" address.
It is missing the subject, the "To:" address, the message body, and any attachment.
What is strange is that sending the same raw email using AWS SDK v2 it comes through correctly.
Here is the raw email:
My implementation of the
SendRawEmail
call is the same in both v2 and v3:I have the SesClient configured using the latest version.
I've spent several hours trying to resolve this issue on my own but have been unable to do so. Does anybody know what I am doing wrong here? Any help is appreciated.