BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Dewald
Calcite | Level 5

Hi,

 

I was hoping someone can give me an example of sending an email with an attachment using a curl command to call the REST Api.

I have been searching without much luck, but have been able to put together the below code from example I found, but it doesn't include an attachment.

curl -s -k -X POST "$SAS_SERVICES_URL/mail/messages" -H "Authorization: Bearer $SAS_CLIENT_TOKEN" -H 'Content-Type: application/vnd.sas.mail+json' -d '{"to": [{"address": "test@test"}],"from":{"address": "user@test"},"subject": "test email","textMessage": "test body"}

 

Is there a way to have a different "from" address other than your own, I have tried adding a different address but get the error : 

 

{"version":2,"httpStatusCode":400,"errorCode":11106,"message":"Invalid 'from' email address. ","details":["path: /mail/messages"],"remediation":"The 'from' email address did not match your email address."}

 

Any link to some documentation on this API will also be very helpful.

 

Thank you in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
gwootton
SAS Super FREQ
I believe you need to be a SAS Administrator to send from an alternate address.

In the application/vnd.sas.mail+json content type the attachments array is at the same level as the to and from arrays, and the objects contain 3 keys: name, type (the MIME type) and data.
--
Greg Wootton | Principal Systems Technical Support Engineer

View solution in original post

1 REPLY 1
gwootton
SAS Super FREQ
I believe you need to be a SAS Administrator to send from an alternate address.

In the application/vnd.sas.mail+json content type the attachments array is at the same level as the to and from arrays, and the objects contain 3 keys: name, type (the MIME type) and data.
--
Greg Wootton | Principal Systems Technical Support Engineer