Remove "[External]" tags added by email server - gmail-api

My organization has begun adding obnoxious warnings to the subject and body of any email that arrives from an external address. My organization allows email forwarding, and I forward to gmail. I would like to have the extra text automatically removed before I see them in gmail. This would not violate the policies at my organization. Some ideas I had:
(1) One option would be to set up a gmail filter that edits the message. This feature does not seem to exist.
(2) Another option would be to customize the display so that this particular text is never shown on the screen. Again, there seems to be no way to do this.
(3) I wrote a script in Google Apps to grab to the content of each offending email and send an edited version to myself, but there is no way to make the "from" field show the original sender (perhaps with good reason). I can put that information in "reply to" but the gmail client doesn't show it nicely. This removes the annoying extra text at the cost of the ability to easily see who sent the email. The core of it is this call:
GmailApp.sendEmail("<my_email_address>",newSubject,newBody,{
attachments: message.getAttachments(),
bcc: message.getBcc(),
cc: message.getCc(),
htmlBody: newBody,
replyTo: message.getFrom(),
});
Any ideas? This is becoming a big problem as the "nanny state" approaches, so I'm sure others will appreciate your solution.

Issue
It unfortunately seems that at the day of this post, there is no way of edditing a forwarded email with the Gmail API. Check the documentation to see what you can actually do with the Gmail API in regards to forwarding email addresses.
Workaround
Despite it is not possible to edit a forwarding email address, in your case you are interested in:
Edit the body and subject of the email address.
Preserve the information of who the sender was.
Therefore what you could do is:
Get the email address you want to edit. Get the body, subject and information about who was sending it and store that.
Create a new message where you edit the message you just got and write on the subject the from field that was in the message you just got.
Send that created message to your desired recipient just like it was a forwarding email.
I hope this has helped you. Let me know if you need anything else or if you did not understood something. :)

Apps Script
You can insert messages into your inbox with their original "From" field but a modified body.
Note: Inserting is different from sending because the message is created on the inbox with less validation than sending.
To use this on Apps Script, take a look at the Advanced Gmail Service.
Custom Application
Another idea on how to do this is to use a custom application (in any language you'd prefer) that:
scans your company inbox with IMAP
manipulates the message body to remove the artifacts you don't want
insert manipulated message into your Gmail inbox with the Gmail API

Related

Intercept gmails/outlook incoming email for further inspection

I want my code to be executed(hotsted as API) whenever there is an incoming email in gmail/outlook(free version).
I want to Reader Header/body/subject information and either automatically reply back or move the email to Trash folder depending on the logic.
I am looking for Event Driven solution as first preference.
Is this possible ? Any pointers to documentation or if someone has developed similar solution is helpful

Mail sent with sp_send_dbmail shows embedded images as attachments

I'm using sp_send_dbmail to send a "welcome" email to employees' newly provisioned mailboxes. The content looks good in both Outlook 2016 and in Office365.
There is a difference from the source email I'm replicating, however, in the how the attachments appear. The source email does not show a paperclip icon or attachments in either system. The email sent with sp_send_dbmail shows the paperclip in both and lists attachments in Office365 (but not in Outlook).
I copied the HTML from the source email in Outlook and had to change the src tags to get it to work:
<img ... src="cid:image009.png#01D42E2D.8043A5B0">
This wouldn't show the images until I removed the #01D42E2D.8043A5B0. I haven't been able to find any explanation of what that part of the tag does or how to use it properly.
Is there a way to make the message sent with sp_send_dbmail appear exactly as the original does?
Edit to add:
Further testing finds that TypeApp (an Android mail client) doesn't render the images from sp_send_dbmail, but it does display the source email correctly.
I realize that email clients won't behave consistently, but why can't I make the email I send behave like the other?
A possible workaround is to use SendGrid email. It might work differently with embedded images. Not sure.
In a previous project I hit a lot of various problems with our internal Exchange server, so I just went outside to SendGrid, which worked very well. They have a free tier.

How do I send test emails from Bugzilla?

I'm using Bugzilla 5.0.2. It wasn't sending emails, so I changed some parameters and now I'd like to test it. I set mail_delivery_method to Test, now what should I do to prompt Bugzilla to send an email? This sounds like a too-simple question, but I can't find anything obvious no matter where I look.
By default Bugzilla doesn't send emails to the person doing the action since they obviously know they did it.
So to send an email create a bug and assign it to someone other than yourself.
Alternatively go to Preference then click the Email Preferences tab and make sure you get emails for all activity.

how to find out wrong email id in mail using java

We will be sending automated emails through a mail box ,we will send an email with two to three emails in TO column and one or more emails in the CC column ,if i have a wrong email in the TO column in that mail box we will get a delivery report that email is wrong i need to write a program such that it will pick up the wrong email id
Start by reading up on JavaMail FAQ and the com.sun.mail.dsn package. The JavaMail Homepage has all of the downloads you'll need.
You could also enable the mail.smtp.reportsuccess property per the documentation:
When sending a message, detailed information on each address that fails is available in an SMTPAddressFailedException chained off the top level SendFailedException that is thrown. In addition, if the mail.smtp.reportsuccess property is set, an SMTPAddressSucceededException will be included in the list for each address that is successful. Note that this will cause a top level SendFailedException to be thrown even though the send was successful.

Cases: how do I include the header of the email if case is email-to-case by outlook

Setup:
When a user does email-to-case the created by field is an automated case user.
Questions:
How do I detect if it was by outlook?
I need to get the orignal sender. I am trying to get the header of the email but I cannot get it for Outlook... Any ideas on how to get the original sender's email or how to get the header?
Thanks-
El Noobre
With email to case you're pretty limited, and direct access to the header isn't possible. But you can get around this if you create your own inbound email handler, which has methods to access the headers. If you google around a bit you can find some good tutorials.

Resources