Hi Amalka,

Thanks for pointing the difference and will update the doc.

Please try with this proxy[1] and the request[2].

[1]
https://github.com/wso2-extensions/esb-connector-gmail/blob/master/src/test/resources/artifacts/ESB/config/proxies/gmail/gmail_sendMailWithAttachment.xml
[2]
https://github.com/wso2-extensions/esb-connector-gmail/blob/master/src/test/resources/artifacts/ESB/config/restRequests/gmail/sendMailOptional.json

On Sat, Aug 19, 2017 at 4:52 PM, Amalka Subasinghe <[email protected]> wrote:

> tried following formats, since sample template and sample request shows
> different properties [1]
> [1] https://docs.wso2.com/display/ESBCONNECTORS/Working+with+
> Messages+in+Gmail#WorkingwithMessagesinGmail-sendMailWithAttachment
>
> <gmail.sendMailWithAttachment>
>            <subject>with attachement</subject>
>            <to>[email protected]</to>
>            <cc>[email protected]</cc>
>            <bcc>[email protected]</bcc>
>            <messageBody>attachement body</messageBody>
>            <fileName>{$ctx:fileName}</fileName>
>         </gmail.sendMailWithAttachment>
>
> and
>
>
> <gmail.sendMailWithAttachment>
>             <subject>with attachement</subject>
>             <toRecipients>[email protected]</toRecipients>
>             <ccRecipients>[email protected]</ccRecipients>
>             <bccRecipients>[email protected]</bccRecipients>
>             <messageBody>attachement body</messageBody>
>             <fileName>{$ctx:filename}</fileName>
>             <filePath>/home/amalka/Desktop/amalka_test_in</filePath>
>          </gmail.sendMailWithAttachment>
>
>
>
> I tried *sendMail* operation that is working without any issue :)
>
> On Sat, Aug 19, 2017 at 4:47 PM, Amalka Subasinghe <[email protected]>
> wrote:
>
>> Hi,
>>
>> I'm trying to send an email with an attachment using Gmail connector. I'm
>> getting the error below. didn;t receive an email. Any idea what's the issue?
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <proxy xmlns="http://ws.apache.org/ns/synapse";
>>        name="sendEmail"
>>        startOnLoad="true"
>>        statistics="disable"
>>        trace="disable"
>>        transports="https,http">
>>    <target>
>>       <inSequence>
>>
>>          <property expression="get-property('transport', 'filename')"
>> name="filename"/>
>>          <gmail.init>
>>             <userId>[email protected]</userId>
>>             <refreshToken>xxxxxxxxxxxxxxxxxxxxxxxx</refreshToken>
>>             <clientSecret>xxxxxxxxxxxxxxxxxxxxxxxx</clientSecret>
>>             <clientId>xxxxxxxxxxxxxxxxxxxxxxxxxx</clientId>
>>             <accessToken>xxxxxxxxxxxxxxxxxxxxxxxxxx</accessToken>
>>             <apiUrl>https://www.googleapis.com/gmail</apiUrl>
>>          </gmail.init>
>>
>>          <gmail.sendMailWithAttachment>
>>             <subject>with attachement</subject>
>>             <toRecipients>[email protected]</toRecipients>
>>             <ccRecipients>[email protected]</ccRecipients>
>>             <bccRecipients>[email protected]</bccRecipients>
>>             <messageBody>attachement body</messageBody>
>>             <fileName>{$ctx:filename}</fileName>
>>             <filePath>/home/amalka/Desktop/amalka_test_in</filePath>
>>          </gmail.sendMailWithAttachment>
>>
>>       </inSequence>
>>       <outSequence/>
>>       <faultSequence/>
>>    </target>
>>    <description/>
>> </proxy>
>>
>>
>> [2017-08-19 16:26:58,395] DEBUG - wire HTTPS-Sender I/O dispatcher-1 <<
>> "POST /gmail/v1/users/[email protected]/messages/send
>> HTTP/1.1[\r][\n]"
>> [2017-08-19 16:26:58,395] DEBUG - wire HTTPS-Sender I/O dispatcher-1 <<
>> "X-Frame-Options: SAMEORIGIN[\r][\n]"
>> [2017-08-19 16:26:58,395] DEBUG - wire HTTPS-Sender I/O dispatcher-1 <<
>> "Authorization: Bearer xxxxxxxxxxxxxxxxxxxx[\r][\n]"
>> [2017-08-19 16:26:58,395] DEBUG - wire HTTPS-Sender I/O dispatcher-1 <<
>> "Alt-Svc: quic=":443"; ma=2592000; v="39,38,37,35"[\r][\n]"
>> [2017-08-19 16:26:58,395] DEBUG - wire HTTPS-Sender I/O dispatcher-1 <<
>> "Vary: Origin[\r][\n]"
>> [2017-08-19 16:26:58,396] DEBUG - wire HTTPS-Sender I/O dispatcher-1 <<
>> "Vary: X-Origin[\r][\n]"
>> [2017-08-19 16:26:58,396] DEBUG - wire HTTPS-Sender I/O dispatcher-1 <<
>> "X-XSS-Protection: 1; mode=block[\r][\n]"
>> [2017-08-19 16:26:58,396] DEBUG - wire HTTPS-Sender I/O dispatcher-1 <<
>> "Expires: Mon, 01 Jan 1990 00:00:00 GMT[\r][\n]"
>> [2017-08-19 16:26:58,396] DEBUG - wire HTTPS-Sender I/O dispatcher-1 <<
>> "Content-Encoding: gzip[\r][\n]"
>> [2017-08-19 16:26:58,396] DEBUG - wire HTTPS-Sender I/O dispatcher-1 <<
>> "Content-Type: application/json[\r][\n]"
>> [2017-08-19 16:26:58,396] DEBUG - wire HTTPS-Sender I/O dispatcher-1 <<
>> "X-Content-Type-Options: nosniff[\r][\n]"
>> [2017-08-19 16:26:58,396] DEBUG - wire HTTPS-Sender I/O dispatcher-1 <<
>> "Pragma: no-cache[\r][\n]"
>> [2017-08-19 16:26:58,396] DEBUG - wire HTTPS-Sender I/O dispatcher-1 <<
>> "Cache-Control: no-cache, no-store, max-age=0, must-revalidate[\r][\n]"
>> [2017-08-19 16:26:58,396] DEBUG - wire HTTPS-Sender I/O dispatcher-1 <<
>> "Transfer-Encoding: chunked[\r][\n]"
>> [2017-08-19 16:26:58,396] DEBUG - wire HTTPS-Sender I/O dispatcher-1 <<
>> "Host: www.googleapis.com[\r][\n]"
>> [2017-08-19 16:26:58,396] DEBUG - wire HTTPS-Sender I/O dispatcher-1 <<
>> "Connection: Keep-Alive[\r][\n]"
>> [2017-08-19 16:26:58,396] DEBUG - wire HTTPS-Sender I/O dispatcher-1 <<
>> "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]"
>> [2017-08-19 16:26:58,396] DEBUG - wire HTTPS-Sender I/O dispatcher-1 <<
>> "[\r][\n]"
>> [2017-08-19 16:26:58,397] DEBUG - wire HTTPS-Sender I/O dispatcher-1 <<
>> "e0[\r][\n]"
>> [2017-08-19 16:26:58,397] DEBUG - wire HTTPS-Sender I/O dispatcher-1 <<
>> "[0x1f][0x8b][0x8][0x0][0x0][0x0][0x0][0x0][0x0][0x0]M[0xce]
>> QN[0x83]0[0x0][0x0][0xd0][0xbb]p[0x82]R[0x6]q&~HM[0xeb]p
>> VK[0xa4][0xa5][0xfd]k[0xa9]i][\n]"
>> [2017-08-19 16:26:58,397] DEBUG - wire HTTPS-Sender I/O dispatcher-1 <<
>> "4[0xc2][0xb6][0x80][0xf1][0xee][0xe2][0xdf].[0xf0][0xf2]~[
>> 0x92]o}M[0xee][0x13]K[0xee][\n]"
>> [2017-08-19 16:26:58,397] DEBUG - wire HTTPS-Sender I/O dispatcher-1 <<
>> ")Ro[0xc8][0xec][0xd9][0xb3]][0xcd]z8K[0xb8][0x9f][0xd1]@S[0xd9][0xc7]
>> 3V[0xb0][0x81][0xaf]Z[0xe4][0xa1][0xcb]^[0x1d][0x83]xQ[0xa8]
>> [0xec]Mvp[0x15][0xa1][0xe0][0xf3]).[0xaa][0xc5][0xa9]j)[
>> 0xa8]7G[0x8b][0xeb][0x8b][0x1a][0xaa][0x8b][0xf9][0x88][
>> 0xde][0x8]<i[0x88]W+*[0xdf][0xc1]pV[0xd0][0x7]F[0xec],E[
>> 0x98][0x8e]=[0xbd][0x18][0x16]O[0x6][0xe6]@[0x89][0x1c][
>> 0x1c]y[0x9d]w[0xa4]),[0xe1];[0x8b][0xf6][0xa3]%[0xe9][0xf4]
>> [0xb6][0x94]'M[0xf0][0xd2]A[0xe][0xde]9o[0xea]/[0xb0]C.2C[
>> 0xf8][0xe6]5N[0xf5][0x9b][0x89]J[0xa0]I[0xe3]d[[0x3])[
>> 0xe8][0xa8][0x4]s[0xf2][0xe6]+[0xff][0xbf][0x8f][0xe3]C[
>> 0xf2][0xfb][0x7]$[0xf2][0x9e]q[0xf2][0x0][0x0][0x0][\r][\n]"
>> [2017-08-19 16:26:58,397] DEBUG - wire HTTPS-Sender I/O dispatcher-1 <<
>> "0[\r][\n]"
>> [2017-08-19 16:26:58,397] DEBUG - wire HTTPS-Sender I/O dispatcher-1 <<
>> "[\r][\n]"
>> [2017-08-19 16:26:58,926] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >>
>> "HTTP/1.1 200 OK[\r][\n]"
>> [2017-08-19 16:26:58,926] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >>
>> "Cache-Control: no-cache, no-store, max-age=0, must-revalidate[\r][\n]"
>> [2017-08-19 16:26:58,927] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >>
>> "Pragma: no-cache[\r][\n]"
>> [2017-08-19 16:26:58,927] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >>
>> "Expires: Mon, 01 Jan 1990 00:00:00 GMT[\r][\n]"
>> [2017-08-19 16:26:58,927] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >>
>> "Date: Sat, 19 Aug 2017 10:56:58 GMT[\r][\n]"
>> [2017-08-19 16:26:58,928] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >>
>> "Vary: X-Origin[\r][\n]"
>> [2017-08-19 16:26:58,928] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >>
>> "Content-Type: application/json; charset=UTF-8[\r][\n]"
>> [2017-08-19 16:26:58,928] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >>
>> "X-Content-Type-Options: nosniff[\r][\n]"
>> [2017-08-19 16:26:58,928] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >>
>> "X-Frame-Options: SAMEORIGIN[\r][\n]"
>> [2017-08-19 16:26:58,929] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >>
>> "X-XSS-Protection: 1; mode=block[\r][\n]"
>> [2017-08-19 16:26:58,929] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >>
>> "Server: GSE[\r][\n]"
>> [2017-08-19 16:26:58,929] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >>
>> "Alt-Svc: quic=":443"; ma=2592000; v="39,38,37,35"[\r][\n]"
>> [2017-08-19 16:26:58,929] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >>
>> "Accept-Ranges: none[\r][\n]"
>> [2017-08-19 16:26:58,929] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >>
>> "Vary: Origin,Accept-Encoding[\r][\n]"
>> [2017-08-19 16:26:58,930] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >>
>> "Transfer-Encoding: chunked[\r][\n]"
>> [2017-08-19 16:26:58,930] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >>
>> "[\r][\n]"
>> [2017-08-19 16:26:58,930] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >>
>> "5b[\r][\n]"
>> [2017-08-19 16:26:58,930] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >>
>> "{[\n]"
>> [2017-08-19 16:26:58,931] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >> "
>> "id": "15dfa23872df474a",[\n]"
>> [2017-08-19 16:26:58,931] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >> "
>> "threadId": "15dfa23872df474a",[\n]"
>> [2017-08-19 16:26:58,931] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >> "
>> "labelIds": [[\n]"
>> [2017-08-19 16:26:58,931] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >>
>> "  "SENT"[\n]"
>> [2017-08-19 16:26:58,931] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >> "
>> ][\n]"
>> [2017-08-19 16:26:58,931] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >>
>> "}[\n]"
>> [2017-08-19 16:26:58,931] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >>
>> "[\r][\n]"
>> [2017-08-19 16:26:58,931] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >>
>> "0[\r][\n]"
>> [2017-08-19 16:26:58,931] DEBUG - wire HTTPS-Sender I/O dispatcher-1 >>
>> "[\r][\n]"
>> [2017-08-19 16:26:58,935] ERROR - GmailMailSender No recipients are found
>> [2017-08-19 16:26:58,935]  INFO - GmailUtils Stored the error response
>> [2017-08-19 16:26:58,935] ERROR - GmailMailSender No recipients are found
>> org.wso2.carbon.connector.core.ConnectException: No recipients are found
>>     at org.wso2.carbon.connector.GmailMailSender.connect(GmailMailS
>> ender.java:53)
>>     at org.wso2.carbon.connector.core.AbstractConnector.mediate(
>> AbstractConnector.java:32)
>>     at org.apache.synapse.mediators.ext.ClassMediator.mediate(Class
>> Mediator.java:84)
>>     at org.apache.synapse.mediators.AbstractListMediator.mediate(Ab
>> stractListMediator.java:97)
>>     at org.apache.synapse.mediators.AbstractListMediator.mediate(Ab
>> stractListMediator.java:59)
>>     at org.apache.synapse.mediators.template.TemplateMediator.media
>> te(TemplateMediator.java:104)
>>     at org.apache.synapse.mediators.template.InvokeMediator.mediate
>> (InvokeMediator.java:148)
>>     at org.apache.synapse.mediators.template.InvokeMediator.mediate
>> (InvokeMediator.java:84)
>>     at org.apache.synapse.mediators.AbstractListMediator.mediate(Ab
>> stractListMediator.java:97)
>>     at org.apache.synapse.mediators.base.SequenceMediator.mediate(S
>> equenceMediator.java:281)
>>     at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediat
>> eFromContinuationStateStack(Axis2SynapseEnvironment.java:766)
>>     at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.inject
>> Message(Axis2SynapseEnvironment.java:282)
>>     at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handle
>> Message(SynapseCallbackReceiver.java:554)
>>     at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receiv
>> e(SynapseCallbackReceiver.java:188)
>>     at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
>>     at org.apache.synapse.transport.passthru.ClientWorker.run(Clien
>> tWorker.java:261)
>>     at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.
>> run(NativeWorkerPool.java:172)
>>     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool
>> Executor.java:1145)
>>     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
>> lExecutor.java:615)
>>     at java.lang.Thread.run(Thread.java:745)
>> [2017-08-19 16:26:58,936]  INFO - GmailUtils Stored the error response
>> [2017-08-19 16:26:58,936] ERROR - GmailMailSender No recipients are found
>> org.apache.synapse.SynapseException: No recipients are found
>>     at org.apache.synapse.mediators.AbstractMediator.handleExceptio
>> n(AbstractMediator.java:367)
>>     at org.wso2.carbon.connector.GmailMailSender.connect(GmailMailS
>> ender.java:56)
>>     at org.wso2.carbon.connector.core.AbstractConnector.mediate(
>> AbstractConnector.java:32)
>>     at org.apache.synapse.mediators.ext.ClassMediator.mediate(Class
>> Mediator.java:84)
>>     at org.apache.synapse.mediators.AbstractListMediator.mediate(Ab
>> stractListMediator.java:97)
>>     at org.apache.synapse.mediators.AbstractListMediator.mediate(Ab
>> stractListMediator.java:59)
>>     at org.apache.synapse.mediators.template.TemplateMediator.media
>> te(TemplateMediator.java:104)
>>     at org.apache.synapse.mediators.template.InvokeMediator.mediate
>> (InvokeMediator.java:148)
>>     at org.apache.synapse.mediators.template.InvokeMediator.mediate
>> (InvokeMediator.java:84)
>>     at org.apache.synapse.mediators.AbstractListMediator.mediate(Ab
>> stractListMediator.java:97)
>>     at org.apache.synapse.mediators.base.SequenceMediator.mediate(S
>> equenceMediator.java:281)
>>     at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediat
>> eFromContinuationStateStack(Axis2SynapseEnvironment.java:766)
>>     at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.inject
>> Message(Axis2SynapseEnvironment.java:282)
>>     at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handle
>> Message(SynapseCallbackReceiver.java:554)
>>     at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receiv
>> e(SynapseCallbackReceiver.java:188)
>>     at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
>>     at org.apache.synapse.transport.passthru.ClientWorker.run(Clien
>> tWorker.java:261)
>>     at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.
>> run(NativeWorkerPool.java:172)
>>     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPool
>> Executor.java:1145)
>>     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo
>> lExecutor.java:615)
>>     at java.lang.Thread.run(Thread.java:745)
>> Caused by: org.wso2.carbon.connector.core.ConnectException: No
>> recipients are found
>>     at org.wso2.carbon.connector.GmailMailSender.connect(GmailMailS
>> ender.java:53)
>>     ... 19 more
>>
>> Thanks
>> Amalka
>>
>
>
>
> --
> Amalka Subasinghe
>
> WSO2 Inc. https://wso2.com/
> Mobile: +94 77 9401267 <+94%2077%20940%201267>
>



-- 
Thank you
Best Regards

*Rajjaz HM*
Software Engineer
Platform Extension Team
WSO2 Inc. <http://wso2.com/>
lean | enterprise | middleware
Mobile | +94752833834|+94777226874
Email   | [email protected]
LinkedIn <https://lk.linkedin.com/in/hmohammedrajjaz> | Blogger
<http://rajjazhm.blogspot.com/> | WSO2 Profile
<http://wso2.com/about/team/mohammer-rajjaz/>
[image: https://wso2.com/signature] <https://wso2.com/signature>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to