Outlook email address format: is there an equivalent of + in gmail? - email

When I want to send something to a gsuite / gmail address, I can do username#domain.com, or username+randomstring#domain.com, or any other random string after +. Is there a similar equivalent in outlook?

Related

Forward Emails preserving recipients (INDY and Delphi)

I retrieve eMails from a GMail account with a TIdIMAP4-object and want to forward them with TIdSMTP to an other (GMail-)account while preserving the original list of recipients.
My approach was adding the destination address as BCC to make it invisible in the destination, but how can I prevent the SMTP component from sending it to all the other recipients in the list? They then would get all the forwarded mails twice.
UPDATE 1:
Instead of using BCC I provided the destination address in the send statement
smtp.Send(msg,destination);
but the message is still sent to all the other recipients.
By default, TIdSMTP.Send() will send the email to all of the recipients listed in the Recipients, CcList and BccList properties of TIdMessage.
When you download an email into a TIdMessage via POP3 or IMAP, the Recipients and CcList (but not the BccList) are filled in from the email's existing To and CC headers, respectively.
When you then forward the email, if you do not want it to be sent to the recipients specified in the email, then you can call the overloaded version of TIdSMTP.Send() that takes a recipient list as a parameter. That will send the email ONLY to that list. For example:
var
forwardTo: TIdEmailAddressList;
begin
...
forwardTo := TIdEmailAddressList.Create;
try
// add desired recipients to forwardTo as needed, then...
smtp.Send(msg, forwardTo);
finally
forwardTo.Free;
end;
...
end;

MailKit: How to get the To email address when it is an alias

I am sending an email to alias#company.com which is an alias to a real mailbox address. I then connect to the real mailbox (let's say realmailbox#company.com) using MailKit and retrieve messages. When I inspect the To address, all I see is the realmailbox#company.com. How to I see the original alias address that the email was sent to?
For example:
var fullMessage = imapClient.Inbox.GetMessage(uid);
var recipients = fullMessage.To;
recipients only show the realmailbox#company.com, not the alias#company.com.
It sounds to me like your SMTP server is performing a string substitution on the alias before passing it along to the recipient mailbox making it impossible to get the info you are looking for.

How to send an email to more than one recepient using Email::Send::SMTP::Gmail

I am trying to write a simple perl script for sending emails using Email::Send::SMTP::Gmail.
Following is the script that I have written so far.
use strict;
use warnings;
use Email::Send::SMTP::Gmail;
my $mail=Email::Send::SMTP::Gmail->new( -smtp=>'smtp.gmail.com',
-login=>'abc#gmail.com',
-pass=>'12345',
-port=>587,
-verbose=>1,
-debug=>1);
$mail->send(-to=>'pqr#gmail.com', -subject=>'Hello!', -body=>'Just testing it', -verbose=>1, -debug=>1);
$mail->bye;
This script works fine.
How can I send this email to more than one person( i.e. more than one email id in the "to" field).
I have tried using:
$mail->send(-to=>['pqr#gmail.com', 'xyz#gmail.com'], -subject=>'Hello!', -body=>'Just testing it', -verbose=>1, -debug=>1);
But I get an error:
Net::SMTPS=GLOB(0x23b77a8)>>> RCPT TO:<ARRAY(0x1ee5e78)>
Net::SMTPS=GLOB(0x23b77a8)<<< 553 5.1.2 The address specified is not a valid RFC-5321 address. w78sm722980qka.25 - gsmtp
From the documentation: put commas between the email addresses.
send(-to=>'', [-subject=>'', -cc=>'', -bcc=>'', -replyto=>'', -body=>'', -attachments=>''])
It composes and sends the email in one shot
to, cc, bcc: comma separated email addresses
attachments: comma separated files with full path
$mail->send(-to=>'a#gmail.com,b#gmail.com,c#gmail.com,...'
Simple add all recipients as a comma separated list:
(-to=>'pqr#gmail.com,rec2#gmail.com' ...

Extract ALL e-mails from GMAIL, GROUP and SORT by frequency contacted

I want to extract all e-mail addresses from GMAIL and GROUP and SORT by the email address. The result is a sorted list of email addresses I contact the most.
After some Googling
I have tried to export contacts (there is an option to select most contacted) - but this resulted in 20 most contacted. Does seem Gmail is counting ...
There is a script by labnol that exports ALL e-mail adresses ... but this is rather slow & does not do the count
question: How can I extract all e-mail addresses from GMAIL and GROUP and SORT by the email address?
Would an export to IMAP work (and count from there)? or is there a smarter way
Many thanks
You have two options
You can indeed extract headers (just headers, you don't need the full message body) from IMAP.
You can use the Gmail API. If you want to count who sends you messages, something like this should work.
Sample code using Gmail API in Python
# Retrieve a page of threads
threads = gmail_service.users().threads().list(userId='me',fields='threads(id)').execute()
# Print ID for each thread
pp = pprint.PrettyPrinter(depth=5)
if threads['threads']:
for thread in threads['threads']:
print 'Thread ID: %s has messages from senders:' % (thread['id'])
t = gmail_service.users().threads().get(userId='me',id=thread['id'],fields='messages/payload/headers').execute()
for msg in t['messages']:
for header_from in [v for v in msg['payload']['headers'] if v['name'] == 'From']:
# There should be only one, but sometimes From is missing
from_field_val = header_from['value']
print from_field_val
# TODO Extract email address and increment count
https://gist.github.com/regisd/3b4733e974483d7994fe

Send email to address alternate from "To:"

I am implementing a sort of dynamic mailing-list system in Rails. I am looking to basically send an email and have the recipient receive it in this form:
From: person#whosentthis.com
To: mailing-list#mysite.com
<body>
Basically, the challenge is how do I send an email to an address while defining a different To: header so that they can easily reply to the mailing list or just the original sender?
Mail vs. Envelope
In emails as in physical mails (paper sheet in paper envelope), the recipient on the envelope may differ from the recipient on the letter sheet itself.
As the mailman would only consider the envelope's recipient, so do mail servers.
That means, one actually can tell the smtp service to send and email to a recipient different than the one listed in the To: field of the emails header.
Trying This Out Manually
You can try this out, manually, for example, by using the sendmail command of postfix.
# bash
sendmail really_send_to_this_address#example.com < mail.txt
where
# mail.txt
From: foo#example.com
To: this_will_be_seen_in_the_to_field_in_email_clients#example.com
Subject: Testmail
This is a test mail.
This will deliver the email to really_send_to_this_address#example.com, not to this_will_be_seen_in_the_to_field_in_email_clients#example.com, but the latter will be shown in the recipient field of the mail client.
Specifying the Envelope_to Field in Rails
The ActionMailer::Base internally uses the mail gem. Currently, Apr 2013, there is a pull request, allowing to specify the envelope_to field on a message before delivery.
Until this is pulled, you can specify the fork in the Gemfile.
# Gemfile
# ...
gem 'mail', git: 'git://github.com/jeremy/mail.git'
You need to run bundle update mail after that, and, depending on your current rails version, maybe also bundle update rails in order to resolve some dependency issues.
After that, you can set the envelope recipient of a mail message like this:
# rails
message # => <Mail::Message ...>
message.to = [ "this_will_be_seen_in_the_to_field_in_email_clients#example.com" ]
message.smtp_envelope_to = [ "really_send_to_this_address#example.com" ]
message.from = ...
message.subject = ...
message.body = ...
message.deliver
Documentation
https://github.com/mikel/mail/pull/477
http://rubydoc.info/github/jeremy/mail/master/Mail/Message#smtp_envelope_to%3D-instance_method
https://github.com/mikel/mail
Why not use the BCC header for this? Put person#whoshouldreceivethis.com into BCC and mailing-list#mysite.com into TO.
Clearification:
There is no technical solution for this. The email headers do what they do, you can't influence them in that once the email is on the way.
I am sure, though, you can find a combined use of TO, CC, BCC and REPLY-TO that gives you what you want.