Using SendGrid From Command Line to Send Attachment

Viewed 1869

I am trying to use sendgrid from a bash command line and need to have the email include an attachment. I have the email going but can't figure out how to include the attachment. I have tried &files as well as &attachment also have tried importing the attachment with << - none of these seem to be working

I have googled and while there is lots of information on using sendgrid there is virtually none on including attachments when using from the command line in a bash script.

1 Answers

Solved my problem - the issue was when I added for the attachment I did not move the apostrophe to the end. Below is my successful command line - Toast.txt is the file I am sending

curl -d 'to=efultz@crunchtime.com &subject=Toast Employee Counts &from=efultz@crunchtime.com &files[Toast.txt]=@Toast.txt &text=Toast-Counts &api_user=****** &api_key=******' https://api.sendgrid.com/api/mail.send.json

Related