ambanmba / aws-ses-sender

Sending an email with attachment by using Amazon SES Services.
5 stars 2 forks source link

SES Sendmail - erroring out on attachment #2

Open yuhup2edy opened 3 years ago

yuhup2edy commented 3 years ago

An error occurred (InvalidParameterValue) when calling the SendRawEmail operation: Expected MIME type, got ;

ambanmba commented 3 years ago

Can you give a few more details about what your setup is?

yuhup2edy commented 3 years ago

Just a simple test using your code to send with and without attachments.

Without - works fine With - errors out with the specific message. Trying to attach a zip file in home directory

Swped, not typed. So please ignore brevity. On Oct 4, 2021, 18:35 -0400, ambanmba @.***>, wrote:

Can you give a few more details about what your setup is? —You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe.

ambanmba commented 3 years ago

Strange, I can't seem to replicate the issue with a .zip file. I am testing on macOS 11.6. Have you checked if Terminal has the right file access?

Settings -> Security & Privacy -> Privacy -> Full Disk Access

2021-10-05_15-54-01

yuhup2edy commented 3 years ago

GM and thanks much for the response. I am using a cloud shell and i have other scripts that seem to read / write files absolutely fine.

I ran a debug on the script and there is the log. You'll also see some errors reported from the editor but the template files get created just fine.

[image: image.png]

On Tue, Oct 5, 2021 at 12:56 AM ambanmba @.***> wrote:

Strange, I can't seem to replicate the issue with a .zip file. I am testing on macOS 11.6. Have you checked if Terminal has the right file access?

Settings -> Security & Privacy -> Privacy -> Full Disk Access

[image: 2021-10-05_15-54-01] https://user-images.githubusercontent.com/18626124/135962420-603fecdf-df5e-45eb-afb2-c228ef183593.png

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ambanmba/aws-ses-sender/issues/2#issuecomment-934061244, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKP6PQIRCS6J7JC4YZGUANLUFKAPDANCNFSM5FKHALWA .

ambanmba commented 3 years ago

@yuhup2edy - your image didn't attach. Can you resend the log? Have you tried attaching a file that is in a different location?

yuhup2edy commented 3 years ago

Figured out the issue. A closer look at the email template revealed at the mimetype was not populated, rather it came back with no value. Upon further investigation, i found that my cloud shell was returning command not found for the "file" that determines the mimetype. So, i went ahead and hard coded a application/zip for the mime type because that's what i will be using always. That helped me get past the error however the zip file came in empty. I tried various other combinations like application/octet-stream, application/x-zip-compressed, multipart/x-zip but none of them seem to send me a valid file. Any thoughts ? What does your mime type return for a zip ?

On Tue, Oct 5, 2021 at 9:14 PM ambanmba @.***> wrote:

@yuhup2edy https://github.com/yuhup2edy - your image didn't attach. Can you resend the log? Have you tried attaching a file that is in a different location?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ambanmba/aws-ses-sender/issues/2#issuecomment-935197792, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKP6PQKF7DNBMCSQQESAZ4LUFOPIXANCNFSM5FKHALWA .

ambanmba commented 3 years ago

A .zip file on my desktop comes up as: "application/zip"

If you leave that part out completely, there shouldn't be any harm, just the receiving e-mail system won't know what the attachment is, but if you know what it is, you just do what you need to with it.

Just remove line 68 and don't include the mimetype at all.

yuhup2edy commented 3 years ago

Strange. Any attachment that i try to send with out without the mimetype is rendering empty.

On Wed, Oct 6, 2021 at 8:48 PM ambanmba @.***> wrote:

A .zip file on my desktop comes up as: "application/zip"

If you leave that part out completely, there shouldn't be any harm, just the receiving e-mail system won't know what the attachment is, but if you know what it is, you just do what you need to with it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ambanmba/aws-ses-sender/issues/2#issuecomment-937354708, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKP6PQNGWC5AHNGREQALK4TUFTU4FANCNFSM5FKHALWA .

ambanmba commented 3 years ago

I think different clients treat it differently. Have you tried sending to a different service (if webmail) or using a different client to read the message?