
Anonymous Community User asked a question.
Send EncryptedEmail using curl?
Do you have a complete example of how to send an EncryptedEmail via the Sharefile API using curl?I'll post what I've tried so far and where I'm getting stuck as well, in case that is helpful.POST to the EncryptedEmail API:```curl -sS -X POST https://mycompany.sf-api.com/sf/v3/EncryptedEmails \\\\-H 'Authorization: Bearer $SHAREFILE_TOKEN' \\\\-H 'Content-Type: application/json' \\\\-d '{'ToRecipients': [{'Email': 'me@mycompany.com'}], 'Subject': 'Testing from sharefile', 'RequireUserInfo': 'true' }'```The above returns successfully with an ID and a URL:```{ 'Id': '4dcc3f7d-foo-bar-baz-123456', 'SentDate': '2020-06-09T16:35:59.973Z', 'Subject': 'Testing from sharefile', 'Uri': 'https://mycompany.sharefile.com/mail/4dcc3f7d-foo-bar-baz-123456';, 'odata.metadata': 'https://mycompany.sf-api.com/sf/v3/$metadata#EncryptedEmails/ShareFile.Api.Models.EncryptedEmail@Ele...;, 'odata.type': 'ShareFile.Api.Models.EncryptedEmail', 'url': 'https://mycompany.sf-api.com/sf/v3/EncryptedEmails(4dcc3f7d-foo-bar-baz-123456)';}```I then POST to the `/Upload2` endpoint of the above URL:```curl -sS -X POST 'https://mycompany.sf-api.com/sf/v3/EncryptedEmails(4dcc3f7d-foo-bar-baz-123456)/Upload2' \\\\-H 'Authorization: Bearer $SHAREFILE_TOKEN' \\\\-H 'Content-Type: application/json' -d '{'Method': 'Standard', 'Raw': 'true', 'FileName': 'message.txt', 'FileSize': 0}'```The above also returns successfully with a ChunkURI key:```{ 'ChunkUri': 'https://storage-hipaa-155.sharefile.com/upload.aspx?uploadid=abcdef-123456..., 'IsResume': false, 'MaxNumberOfThreads': 4, 'Method': 'Standard', 'ProgressData': '...', 'ResumeFileHash': '', 'ResumeIndex': 0, 'ResumeOffset': 0, 'odata.metadata': 'https://mycompany.sf-api.com/sf/v3/$metadata#UploadSpecification/ShareFile.Api.Models.UploadSpecific...;, 'odata.type': 'ShareFile.Api.Models.UploadSpecification'}```I then upload a file which I want to use as a message body to the above ChunkUri:```curl -sS -F FileName=@/tmp/msgbody 'https://storage-hipaa-155.sharefile.com/upload.aspx?uploadid=abcdef-123456...'```That just responds with `OK`, and nothing else.I can then send the email using: ```curl -sS -X POST https://mycompany.sf-api.com/sf/v3/EncryptedEmails\\\\(4dcc3f7d-foo-bar-baz-123456)/Send -H 'Authorization: Bearer $SHAREFILE_TOKEN' -H 'Content-Type: application/json' -d '{\\\\'Message\\\\': {\\\\'Id\\\\': \\\\'4dcc3f7d-foo-bar-baz-123456\\\\'}}'``` This does result in an email being sent. I can receive it in my Gmail account, etc. However, when I click the link to view the email, it gets stuck in a loop saying 'Decrypting...' and never actually shows me the content of the email. Do you have an end-to-end example of how to send an encrypted email using curl? Preferably with an attachment? Thanks.