You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by Xiaobo Yang <xi...@gmail.com> on 2006/01/07 02:37:36 UTC
Could not send email with attachment to ms exchange server
Hi, I can send an email using Slide through MS exchange server but have
problems to add attachment. I used the code below but always with status
code 403 returned. I suppose attachment can be added to the message body.
Any idea? Thanks in advanced.
Xiaobo Yang
PutMethod putMethod = new PutMethod(sUri); // sUri - mail
submission uri
putMethod.setRequestHeader("MIME-Version", "1.0");
String boundary = "lalala";
putMethod.setRequestHeader("Content-Type",
"multipart/mixed; boundary=\"" +
boundary + "\"");
//putMethod.setRequestHeader("Content-Disposition", "attachment;
filename=\"ral_031105.txt\"");
putMethod.setRequestHeader("Translate", "f");
putMethod.setRequestHeader("Saveinsent", "f");
//putMethod.setRequestHeader("Content-Type", "message/rfc821");
String sQuery = "--" + boundary + CRLF +
"Content-Type: message/rfc821" + CRLF + CRLF +
"MAIL FROM:<" + email.getFrom() + ">" + CRLF +
"RCPT TO:<" + email.getTo() + ">" + CRLF +
"RCPT TO:<" + email.getCc() + ">" + CRLF + CRLF
+
"Subject:" + email.getSubject() + CRLF + CRLF +
email.getBody() + CRLF + CRLF +
"--" + boundary + "--" + CRLF +
"Content-Type: text/plain" + CRLF +
"Content-Disposition: attachment; filename=\"ral_031105.txt\""
+
CRLF + CRLF +
"Attachment text" + CRLF + CRLF;
putMethod.setRequestEntity(new org.apache.commons.httpclient.
methods.StringRequestEntity(sQuery));
putMethod.addRequestHeader("Content-Length",
new Integer(sQuery.length
()).toString());
Re: Could not send email with attachment to ms exchange server
Posted by Xiaobo Yang <xi...@gmail.com>.
Have a look at HttpClient SSL guide
http://jakarta.apache.org/commons/httpclient/sslguide.html.
Xiaobo
On 3/30/06, Hendrik <he...@vanderwatt.co.za> wrote:
>
> Xiaobo Yang <xiaobo.yang <at> gmail.com> writes:
>
> >
> > Hi, I can send an email using Slide through MS exchange server but have
> > problems to add attachment. I used the code below but always with status
> > code 403 returned. I suppose attachment can be added to the message
> body.
> > Any idea? Thanks in advanced.
> >
> > Xiaobo Yang
>
> I am new to Slide. How do I connect to my exchange server with HTTPS? I
> have
> tried the code below
>
> org.apache.commons.httpclient.HttpsURL hrl = new
> org.apache.commons.httpclient.HttpsURL(
> "https://<server>/exchange/<user
> alias>/Inbox");
> NTCredentials ntc = new NTCredentials
> ("<username>", "<password>",
> "<domain>", "CC");
> WebdavResource wdr = new WebdavResource(hrl, ntc,
> WebdavResource.ALL, DepthSupport.DEPTH_1);
>
> But I always get an 440 error.
>
> Any Ideas?
>
> Thanks
>
> Hendrik
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>
>
Re: Could not send email with attachment to ms exchange server
Posted by Hendrik <he...@vanderwatt.co.za>.
Xiaobo Yang <xiaobo.yang <at> gmail.com> writes:
>
> Hi, I can send an email using Slide through MS exchange server but have
> problems to add attachment. I used the code below but always with status
> code 403 returned. I suppose attachment can be added to the message body.
> Any idea? Thanks in advanced.
>
> Xiaobo Yang
I am new to Slide. How do I connect to my exchange server with HTTPS? I have
tried the code below
org.apache.commons.httpclient.HttpsURL hrl = new
org.apache.commons.httpclient.HttpsURL(
"https://<server>/exchange/<user
alias>/Inbox");
NTCredentials ntc = new NTCredentials
("<username>", "<password>",
"<domain>", "CC");
WebdavResource wdr = new WebdavResource(hrl, ntc,
WebdavResource.ALL, DepthSupport.DEPTH_1);
But I always get an 440 error.
Any Ideas?
Thanks
Hendrik
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org