My program picks up mail from a PoP3 enabled email exchange server.
This mails have screen shots as part of the body.
I want to save the screenshots in the mail on the local drive.
I am using JavaMail API.
The API doesnot pick up the screenshot as an inline attachment but rather says the mime type of the email message is text/html.
How do I pick up this screenshot using javamail.
All I get is a src:cid
If it's referencing the screenshots using src:cid, the text/html will be one part of a multipart/related and the screenshots will be other parts. You can match up the cid reference with the Content-ID of the parts.
Related
I am using Send Grid Apex package for sending out bulk email from salesforce. It's possible to send text files as an attachment with the help of Send Grid API, but it fails for every other type of files (like PDF etc).
Is there any workaround for this problem? I have tried calling web API of sendgrid for attachments from Apex code with the help of callouts. Its not working for PDF and other files.
API doc:
https://github.com/sendgrid/sendgrid-apex
I am using the Gmail API to put messages into a Google Apps email account. I use
the OAuth 2.0 authentication protocol with a service account. This is more or
less working fine. One of our customers has asked us to put messages
directly into a Google Vault. I don't see a Vault API, but I did find this
information related to the "insert" method (which is what we use to add
messages to a normal account):
parameter "deleted" (boolean): Mark the email as permanently deleted
(not TRASH) and only visible in Google Apps Vault to a Vault administrator.
Only used for Google Apps for Work accounts.
When I do this, some messages are accepted, but frequently I get http error
500 in response to the POST. The error text says "Backend Error". I thought
the pattern was that the first time the message was posted, it would work,
but the second time would generate the error. Therefore I was thinking it
was a duplicate check issue. However I now see some examples of messages
that fail immediately. The POST url looks like this:
https://www.googleapis.com/upload/gmail/v1/users/user#domain.com/messages?uploadType=multipart&internalDateSource=dateHeader&deleted=true&access_token=ABC...
As I mentioned, the same message to the same url (without deleted=true) will
always work. Any ideas what is causing the error?
Was just fighting this issue myself. Apparently the error has something to do if the message is compatible with the Google vault retention policies:
If I turn on a default policy of "Retain everything" then I've been able to get the messages to import correctly. HTH!
I'm using the import api method and the backendError seems to be related to filters/policies. For example we asked Google to reject messages with xls and macros and we get the error on mail with that kind of attachment
You can receive message flags such as "Read"/"Unread" or "Flagged"/"Not flagged" using Google Mail API. You can see this information in field labelIds in result of Users.messages: get function:
If label STARRED presents, it means that message was marked with asterisk.
If label UNREAD presents, it means that message is unread yet.
Question I
I can't find how to check if message was marked as "Important".
Does anyone know if there is a way to detect this flag using Google Mail API?
Question II
You can mark message with different asterisks (red, green, blue), but Google Mail API doesn't return this information in Users.messages: get function.
Can I determine what kind (what color) of asterisks has message using Google Mail API?
Based on saying "message flags" I assume you're using Gmail IMAP now? The Gmail API does expose the common Gmail labels on a message (like Starred and Unread), but not anything IMAP-specific (e.g. \Deleted, \Recent).
IMAP \Flagged maps to the Star in the web interface and "STARRED" in the API:
https://developers.google.com/gmail/api/guides/labels
The Important label (corresponding to the \Important mailbox in IMAP) should be visible in the in the API as well (system label called "IMPORTANT").
The different color stars are not currently supported by API (refer to the above labels guide for the current authoritative list of supported SYSTEM labels).
I'm using remote smtp server(from my host company) and send
email from local computer.(google app development server)
But instead of getting nice emails
i get emails that contain headers as if it ware content of email
What can do to change it?
My guess is that you have a newline (\r\n or Carriage Return -Line Feed) in your subject. And, your mailing program doesn't strip newlines in the subject.
If you put a newline in the subject, and your app doesn't remove it, you just moved all following headers down to the body.
Send the email according to the SMTP RFC: https://www.rfc-editor.org/rfc/rfc5321
Getting the headers in the content sounds like you sent them twice or did separate the headers from the content in a way your mail client does not understand.
Check you don't have something wrapping what you send in another layer of email.
Perhaps look at the current (real/outer) headers to see if that gives any clues.
Can you show us your code, please? You don't say which App Engine runtime you're using; I'll assume Python. The App Engine mail API doesn't let you directly set message headers. There's a list of attributes you can set here.
I'm working on an email solution in SQL Server ONLY that will use Database Mail to send out HTML formatted emails. The catch is that the images in the HTML need to be embedded in the outgoing email. This wouldn't be a problem if I were using a .net app to generate & send the emails but, unfortunately, all I have is SQL Server.
Is it possible for SQL Server to embed images on its own?
You have two possibilities:
(easy) Host the images somewhere, and reference them in the <img src="...">.
(difficult) Encode them in Base64 and build a multipart MIME message with known content IDs, so they can be referenced in the message body via cid: URIs.
Each possibility has its downsides:
Remote images may not be loaded on the modern e-mail clients for privacy.
Probably rises spam score.
When the receiving clients are in your control (e.g. same organization), you might be equally fine with either way.
Yes, what you need to do is include the images as attachments and then they can be referenced within the HTML.
Use the #file_attachment parameter of sp_send_dbmail
You could try to encode the image as base64 and reference it directly in an img tag within the email ( <img src="data:image/png;base64[your encoded image here...] ) but i think most email clients correlate this technique with spam. I think you're better off referencing hosted images or simply attaching it to the email.