Page 1 of 2

How to send New Email with Attachment using Zimbra API

Posted: Fri Feb 27, 2009 5:59 pm
by VistoPartner
Hi Guys,
I was trying to figure out how to send a new Email with attachment. When I looked at the soap.txt file, I saw that I have to upload the attachment first and then use the returned attachment-upload-ID for the SendMsgRequest.
I couldn't find any example or how to use the FileUploadServlet. Can anybody help me where to look for an example?
Thanks.

How to send New Email with Attachment using Zimbra API

Posted: Thu Feb 28, 2013 1:49 am
by parin
I have same problem.. there is no guide how to upload and use that id in request... did you get the solution ??

How to send New Email with Attachment using Zimbra API

Posted: Mon Mar 11, 2013 2:16 am
by 13546dalmate
Hope you know how to use SOAP by java.

You can use 2 SOAP requests to do this thing: FileUploadServlet and SendMsgRequest.

In the first step, you use FileUploadServlet to upload your message to server and get message's id from FileUploadServlet's response.

In SendMsgRequest, it has an attribute aid, all you need is giving it message's id.

How to send New Email with Attachment using Zimbra API

Posted: Tue Mar 12, 2013 6:44 am
by parin
thank you dalmate for your reply. i know there are two steps to upload a file on server. but it would be best if the sample code is available to upload any file to zimbra. i know how to send message and how to add attachment id v. but don't know the exact code example about how to upload it.
Thank You

How to send New Email with Attachment using Zimbra API

Posted: Tue Apr 02, 2013 12:43 am
by parin
here is a link to a full documentation of zimbra soap API :- SOAP API Reference Material Beginning with ZCS 8.0 - Zimbra :: Wiki

How to send New Email with Attachment using Zimbra API

Posted: Tue May 28, 2013 1:18 pm
by 13546dalmate
[quote user="parin"]here is a link to a full documentation of zimbra soap API :- SOAP API Reference Material Beginning with ZCS 8.0 - Zimbra :: Wiki[/QUOTE]

If you want to upload file to Zimbra, don't use SOAP because Zimbra does not have this service.

I recommend you use httpupload to upload to this url: http[s]://yourdomain.com/service/upload

Re: How to send New Email with Attachment using Zimbra API

Posted: Wed Aug 03, 2016 11:09 am
by manawa
13546dalmate wrote:
In the first step, you use FileUploadServlet to upload your message to server and get message's id from FileUploadServlet's response.

.
Actually I don't get any ID from the FileUploadServlet's response.

The response I get is something like

Code: Select all

200, null, 2443203b-c634-4404-be27-d837c7f7fbb7:3fbf9648-7977-40f7-8ee0-f20119d6cdbf
with the last number being a server token I presume.

How to get the uploaded file ID please ?

Re: How to send New Email with Attachment using Zimbra API

Posted: Thu Aug 04, 2016 7:37 am
by manawa
parin wrote:thank you dalmate for your reply. i know there are two steps to upload a file on server. but it would be best if the sample code is available to upload any file to zimbra. i know how to send message and how to add attachment id v. but don't know the exact code example about how to upload it.
Thank You
Hello Parin,

Did you managed to get the upload working and get message's id from FileUploadServlet's response ?
Thanks

Re: How to send New Email with Attachment using Zimbra API

Posted: Tue Jul 28, 2020 3:30 pm
by dvidalg
manawa wrote:
13546dalmate wrote:
In the first step, you use FileUploadServlet to upload your message to server and get message's id from FileUploadServlet's response.

.
Actually I don't get any ID from the FileUploadServlet's response.

The response I get is something like

Code: Select all

200, null, 2443203b-c634-4404-be27-d837c7f7fbb7:3fbf9648-7977-40f7-8ee0-f20119d6cdbf
with the last number being a server token I presume.

How to get the uploaded file ID please ?

Hi manawa,

I'm new on this and trying to send an email with attachment with soap.
I get an error when uploading the attachment to /service/upload, probably because I'm not doing right with the content then use httpPost.setEntity
I think you got it and that "2443203b-c634-4404-be27-d837c7f7fbb7:3fbf9648-7977-40f7-8ee0-f20119d6cdbf" is the aid (attachment id)

Could you tell me what java code you used to make the post to upload the attachment file?


Thanks and best regards :)

Re: How to send New Email with Attachment using Zimbra API

Posted: Wed Jul 29, 2020 6:24 pm
by barrydegraaff
In Java you can do:
https://github.com/Zimbra-Community/zim ... .java#L480


In javascript you can do:
https://github.com/Zimbra-Community/rma ... l.js#L1511

From the CLI on Zimbra you can use:
cat /tmp/youremailmsg | /opt/zimbra/common/sbin/sendmail account@example.com
see: https://help.dreamhost.com/hc/en-us/art ... -Sendmail-