How to access sent by property of gmail via app script? - email

There is a group mailbox which is used by few users via delegated access. The emails that are sent from this group mailbox displays that email is from the group mailbox and sent by property shows the email address of the individual who has sent this email via delegated access.
In Google Apps Script how to get the value of the "Sent By" from the emails sent from this gmail account?

App Script has a class for Gmail API called GmailMessage. GmailMessage class has the getFrom() method which gets the sender of the message.
snippet:
var thread = GmailApp.getInboxThreads(0,1)[0]; // get first thread in inbox
var message = thread.getMessages()[0]; // get first message
Logger.log(message.getFrom()); // log from address of the message

Related

Outlook emails sent to invalid email with URL in them get clicked

We are deploying an app where after signing-up you receive an email to a URL with a token that will call an API that simply switches a bool in the DB called confirmed. There is no other way to alter this bool other than through this API.
We recently switched our gmail smtp to an outlook365 one and discovered that any email that is invalid gets this boolean toggled. To be more specific I've noticed that there are two types of invalid emails:
One where we receive an email from Microsoft Outlook
Your message to test#whatever.com couldn't be delivered.
test wasn't found at whatever.com.
and another where we receive the same email from postmaster#officedepot.onmicrosoft.com
Only the ones received from postmaster are getting validated.
I believe the links are somehow automatically being called?
Could anyone validate my theory?

Receive an email sent by me in Google Grups

I use Google groups to manage a mailing list and when some member send an email, he/she (as the sender) does not receive it nor has evidence of the effective sending, while other members subscribed to the group get the message. The sender is one of the members of the group. Is there any way to configure the sender member to receive his/her own sent mail?

Bulk set 'send on behalf of'

I have a service account for an application that is used to send out emails via a MSExchange server. The 'From' field gets populated by the email address in the current users profile, but the server is sending back a response
"SmtpException: Mailbox unavailable. The server response was: 5.7.1 Client does not have permissions to send on behalf of the from address."
As there are alot of email addresses that could be being sent from, is it possible to set up the service account so that it will have send on behalf permissions for "*#domain1.com email addresses" or do they all have to be added one at a time?
Send on behalf isn't really possible like this given how it's set. If you were OK with Send-As (so the mails would come from Service1#domain1.com versus Service1 on Behalf of bob#domain1.com), you could grant the service account send-as rights at the domain, OU, or mailbox database levels.

invite gtalk user via xmpphp

I have set up a basic install of XMPPHP and to test it I tried sending a message from one of my gtalk (GoogleTalk) accounts to another gTalk account. The receiving account did not show the message, or the normal "user * has sent you a message: accept/block"
I then sent my receiving account a chat message from within the Google interface, and it prompted me (as expected) to add my account to the list of approved chat people.
Once my sending account was on the "approved" list, i was able successfully to send messages with xmpphp with no problem.
My question: Using xmpphp, how do i send an INVITATION to chat? I can send messages fine once the recipient accepts my incoming chats, but the first message sent does not trigger the chat program to prompt me to accept the messages.
As a follow-up...is there a way to find out if the recipient has accepted the request? ANy way to know that the messages are being delivered (or not)?
I had the same problem and the solution is to send a "subscribe" request before the message.
So just call
$conn->subscribe('someguy#someserver.net');
before
$conn->message('someguy#someserver.net', 'This is a test message!');

Sending email through GmailApp(), return path ...#maestro.bounces.google.com

I am trying to set up a script that takes in email from an email address A.From within Gmail inbox B, the script opens up a new message, and sends the exact same message as was received from A, except the new message is being sent from B to another user C. So instead of being sent from A to C, the email is shown as being sent from A to B then from B to C. The script I have works perfectly, except there is one issue. The return path on the email address I sent from the script using GmailApp() is as follows:
Return-Path: 3Ej_rTwsOAMElvk_1z-0lz03lsjohss5u.jvt#maestro.bounces.google.com
The result of having this return path is causing the desired recipient not to receive the email being sent because it is being sent to their spam box instead of their inbox.
My question is this: Do the email sending functions in Google Apps Script send email from a third party email provider rather than from within the Gmail account of the user running the script? Is this supposed to be functionality of GmailApp() and MailApp()?
Yes, you're correct. Currently the GmailApp and MailApp services do not send via the user's account. There's a filed, open enhancement request on the issue tracker to look at this: http://code.google.com/p/google-apps-script-issues/issues/detail?id=674