email header "from" containing first and last names, not sender's email - pop3

I'm reading emails from pop3 server with zend mail component.
What I want is to know who is sent this email and when I try $message->from I see "FirstName LastName" without senders email.
I do print_r($message->getHeaders()) and do not see sender's email in any header from this email.
I thought that senders email is required and always must be set. Anything wrong here?
Is that possible to have email with "from" header with only First/Last name without email?

As per my comment:
if you print_r() a valid from header and the address is in angle brackets, you may only see it by viewing the HTML source, because the angle brackets and email address may be treated as an (albeit unrecognised) HTML tag, by the browser.
However, if anyone encounters this issue in the future (and the email address does not show in the HTML source), it is worth bearing in mind that the sender could have sent an email without a From: address, even though that is technically invalid.

Yes, this is totally possible. There are 2 usually "FROM" addressess with every email. 99% of the time, these are the same values, but they can be different. There is the MAIL FROM address that is used during the SMTP session, that issues the MAIL FROM command. Then, there is the FROM address found in the email message headers (this FROM address is sent during the SMTP DATA command). This is how you can get email spoofing.
Think of it this way (in the snail mail physical world). You can have a FROM address on the outside of an envelope (this would be equiv to the MAIL FROM command). This is supposed to be the person sending the message. You can then have a FROM value that is different on the letter head that is inside the envelope. This would be the FROM value you are seeing in the email headers.
Here is an example of some raw headers without a FROM address
From: "Steve James"
To: "John Doe" <you#yourcompany.com>
Date: Fri, 24 Feb 2012 07:43:40 -0800
Subject: Here is the progress report
....
Hopefully I didn't make that about as clear as mud.
--

Use the following format:
Firstname Lastname <vasya#poupkine.com>

Related

How to send email "from" customer's email using SES

I am a beginner developing my first site and I'm using AWS as my hosting platform. On my site I have a Contact Us form where the user can input their name, email and message then hit submit.
I am using SES to send the email from the Contact Us form, but I have a problem. I am aware that SES can only send emails from a verified email address, however I would like to set my From header to be the email address entered by the customer. This is so that when the mail arrives in my mail client it shows the customer's name on the left, next to the subject, before I click into the email.
I tried setting the Sender header to my verified email so that I could use the From header as the customer's one, but it made no difference.
I have been following this guide but as soon as I change <sender#example.com> to anything other than my verified email address it won't work.
The bash script which I'm using to send the email looks like this:
emailInput='AUTH LOGIN
*myBase64EncodedSMTPLogin*
*myBase64EncodedSMTPPassword*
MAIL FROM: '"${1}"'
RCPT TO: *my ses verified email address*
DATA
From: '"${2}"' <'"${1}"'>
To:
Subject: Message from *mysite.com*
'"${3}"'
.
QUIT'
echo "$emailInput" > ./tmpEmailInput.txt
openssl s_client -crlf -quiet -starttls smtp -connect *aws smtp endpoint* < tmpEmailInput.txt
rm ./tmpEmailInput.txt
In the above code, the arguments are as follows:
The first argument is the customer's email address.
The second is their name.
The third is their message.
If I change $1 in both places to my verified email address it works, but then in my mail client is says "me" as the sender, because the verified email address is both sending and receiving. I can only see the customer's name in the field at the top once I click into the email.
I would greatly appreciate some advice.
Thank you.

Exim - identify recipient BCC address

I'm using plus-addressing on Exim to create an automated system - I will process emails based on the local part of the address. So eg:
From: me#eximdomain.com
To: robot+project-4#eximdomain.com
This works well - I can process it based on the To address (specifically project-4). But ideally I want to be able to BCC an email to this address, eg:
From: me#eximdomain.com
To: somebody#otherdomain.com
Bcc: robot+project-4#eximdomain.com
When I am checking the mailbox for robot, I see the message, but nowhere in the header is the actual address that got it there, ie robot+project-4#eximdomain.com - so I cannot process it.
Obviously I do not want somebody#otherdomain.com to be aware of this address; but when robot#eximdomain.com receives it, I want to know that it was actually BCCd to robot+project-4#eximdomain.com (in some/any header).
Is there any way to do this?
Figured this out, if anyone comes across this: added this option to my local delivery transport (Dovecot LMTP in my case):
envelope_to_add = true
It then generates an Envelope-to header containing the incoming address.

A way to get BCC recipients from a email on S3 (SES email receiving)

I am using SES inbound that stores the raw messages in S3. Emails get into a bucket and then I have a script that parses every email in the bucket and extracts all the email recipients.
The problem is that sometimes, with emails where all recipients are in BCC, there is no way to know who are the recipients, there is no header with the values in the raw email. Seems that looking to the raw there is no way to get the BCC recipients.
How can I know which are the real addresses the mail was originally destined to? Perhaps there is a way to add a custom header to the raw with the recipients or playing with some SES API and the X-SES-RECEIPT, I don't know.
For anyone with the same concerns, right from an AWS engineer:
In order to receive useful metadata like the recipients the message was delivered to (without having to parse headers), I recommend subscribing to SNS notifications for emails received with your S3 action.
The 'recipients' field of the notifications will contain the information you are looking for. More details on contents here: http://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-notifications-contents.html
More info on the SNS topic property of the S3 action can be found here: http://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-action-s3.html
It looks like there is a Received header that contains a '... for email#foo.com;' address within it. However, i've seen it both as '... for email#foo.com;' and as '... for ;'. So it is a little tricky to parse out.
E.g. in this case the recipient is: email.foo.com
Received: from mail-qt0-f876.google.com (mail-qt0-f876.google.com [209.85.216.176])
by inbound-smtp.us-west-1.amazonaws.com with SMTP id 8t8gp7m0c81g6ddn1g8b7klev4cnlup039tuhlg1
for test#email.foo.com;
Thu, 12 Oct 2017 00:51:01 +0000 (UTC)
I've also seen (even in the same message):
Received: by mail-qt0-f876.google.com with SMTP id v41so999755qtv.12
for <test#email.foo.com>; Wed, 11 Oct 2017 17:51:01 -0700 (PDT)

OpenPop Can't read who received the email

I am trying to create a dropbox email for my website.
So I have created a catch all email address: dropbox#domain.com
Each customer on the website will then be given a dropbox email each ex: dropbox123#domain.com
Customers can then bcc emails to the given email and it will automatically enter the stuff into the notes.
When Reading through the emails caught by dropbox#domain.com I would then like to determine which email address was put in bcc and react accordingly.
Now to the question:
When opening up the email directly on the server I can see the raw email in notepad and the first line says:
Received: from ([209.85.215.58]) for <dropbox123#domain.com> with MailEnable
Catch-All Filter;
Sun, 4 Jan 2015 21:16:44 +0000
When reading this email through OpenPop I get this:
Received: from ([209.85.215.58]) for with MailEnable Catch-All Filter; Sun, 4 Jan
2015 21:22:35 +0000
So the "for" email address is not part of the openpop message header.
It does not matter if I take the OpenPop.Mime.Message.RawMessage or I try to read the header.
Is this a bug in the OpenPop or am I missing the obvious?
This looks like a bug in OpenPOP (it should not be changing the values of the headers). I would recommend submitting a bug report to https://github.com/foens/hpop and hopefully the developer will implement a fix for you.
If not, I would suggest using MailKit which does not have this problem.

Debugging K2 workflow - how to view data associated with error conditions?

I have a K2 Blackpearl workflow. In the workflow I populate a process data field with email addresses pulled from a SharePoint list. Using the Text - Join function with the SP List's SmartObject's GetList method for the values and a semi-colon for the separator.
In theory, this should produce a well-formatted string with multiple addresses for the "To" line of the E-mail event. However, I keep receiving a "The specified string is not in the form required for an e-mail address." at the point where the workflow should attempt to send an email.
I've tried using the string "john.doe#company.com;jane.dove#company.com;abc.def#company.com" directly and I've tried splitting the string on the semi-colons in the Activity's destination set. In the first case, there is one instance trying to send the email. In the second instance, the emails are resolved to users and though I select the "ActivityInstanceDestUserEmail" for the "To" line, I still get the error message.
We are using K2 Blackpearl 4.6 with a SharePoint 2010 farm configured strictly for Claims authentication. The users to which I wish to send the email have valid email addresses if resolved using the K2SPS provider, but when the emails are resolved into destination slots, they are resolved into accounts with the K2 provider. I'm guessing that this is the problem with my second method for sending the email. But the first, putting the whole string in the "To" line should have worked it is straight email addresses - no resolving to users is needed.
What am I doing wrong? Is there another way to accomplish this?
Changes in the configuration of our customer security provider, labelled "K2SPS" seem to have resolved the problem - at least for now.