Sending email Using Apache common and CQ5 mail API — Adobe CQ5

Apache mail common comes as out of box in Adobe CQ5 platform as OSGI bundle and and CQ has its own API on top of that can be used to send all kind of email

  • Plain text
  • HTML Formatted
  • and any kind of attachment.

Code snippets to send email. Please refer to the document

URL http://commons.apache.org/proper/commons-email/userguide.html

When you send email as plain text , you would not see much difference in terms of formatting for different-2 mail client , but when it is HTML formatted you would find it varies across  outlook, Gmail, Yahoo even on Smartphone.

Retest it correct your HTML CSS class etc to ensure it looks uniform across all kind of mail client. Also if you are mail content has java script or long hash based query string data are not going work in email ..remember mail box is not browser, its Application and mail server apply their own set of security.

One of the primary reason why i wrote this blog is that outlook consistently shows this attachment  (ATT00001.htmattachment  when we sent HTML formatted email content but same was not appearing in G-Mail and Yahoo. refer to the below image attached.

Image

I referred multiple post and forum and everybody has their own understand and interpretation but none has worked for us.
Few URL worth sharing here.

http://stackoverflow.com/questions/1821464/attachmentshtml-generated-with-commons-email-doesnt-show-in-some-email-clients

https://discussions.apple.com/message/10966873#10966873

What’s Solution:

it’s code issue and nothing else.

  • Email object was not created on right place.
  • Session object too
  • also email recipients

When finally code was rescanned and arranged that attachment stopped coming in outlook.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s