The mails are sent with default From address as wasadm#servername which I want to change. I tried using the property mailFrom at application.inf file, changed the values at websphere console - Resources >> Mail >> Mail Sessions >> Return e-mail address but nothing worked out.
Could you please let me know if you have some solution to replace the default from mail address to a custom value.
Normally, the email-sending application code sets a "from" address in the message itself.
That said, I think it might work to set a Mail Session Custom property of mail.from. According to https://javaee.github.io/javamail/docs/api/overview-summary.html:
mail.from The return email address of the current user, used
by the InternetAddress method getLocalAddress.
I know from experience that the envelope sender address can be set with Custom property mail.smtp.from. See https://javaee.github.io/javamail/docs/api/com/sun/mail/smtp/package-summary.html
mail.smtp.from Email address to use for SMTP MAIL command. This sets the envelope
return address. Defaults to msg.getFrom() or
InternetAddress.getLocalAddress(). NOTE: mail.smtp.user was previously
used for this.
Related
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.
When I mark the message in this way
I use the method
var uids= folder.Search(SearchQuery.DeliveredAfter(DateTime.Parse("2016-9-29")).And(SearchQuery.Flagged));
cannot get the flagged mail,
but when I use methodfolder.AddFlags(new UniqueId(1693), MessageFlags.Flagged, false);
folder.Expunge();
the mail will be flagged and When I use the method
var uids= folder.Search(SearchQuery.DeliveredAfter(DateTime.Parse("2016-9-29")).And(SearchQuery.Flagged));
I can get the flagged mail,I don't know why, and how can I get the flagged mail?
You are conflating 2 different ways of "flagging" a message. Outlook does not set the MessageFlags.Flagged flag, that's why Search() does not find it.
Most likely Outlook either does not store anything on the IMAP server at all (and that state is stored locally in the .pst file) -or- it stores a custom UserFlags string on the IMAP server that you will need to figure out.
If you know of a particular message on your IMAP server that has this custom flag, you can use the Fetch() method with MessageSummaryItems.Flags to request what flags are set. Then, you can examine the item.UserFlags and hope that you find what you are looking for.
I'm trying to get the email provider (ex: gmail,outlook,yahoo) from any email address so that i can use specific smtp settings to avoid my messages being listed as spam.
My current approach is parsing the mail server potion of the email address and using that as the identifier but email providers have multiple mail servers (ex: outlook has outlook.com but also live.ca).
Any suggestions of a simple approach to identifying the mail provider? If there is any method using PHP that would be especially desirable. Any help?
You can use a map for mapping the mail domain name (that you obtain after parsing the e-mail address) to the mail provider:
$providerMap = array(
"gmail" => "Gmail"
"outlook" => "Outlook"
"live" => "Outlook"
# etc...
);
Then, you can use it like this:
$providerDomain = getDomain($emailAddress); // assuming getDomain() is the function that parses an email address and returns
echo "The provider is: $providerMap[$providerDomain]"
P.S.: You may want to think about how to handle the case where the email address domain name doesn't match any provider. You can:
Throw an exception/display an error message
Add a functionality allowing an authorised user to add a new provider (i.e. for adding a new entry in the map)
...
I currently setting up a little tool for my company that is used to send info-mails to specific user groups.
But if one or more email addresses are incorrect (missing letter etc.) I get following error and the email isn't sent at all:
EIdSMTPReplyError
Requested action not taken: mailbox unavailable
invalid DNS MX or A/AAAA resource record
I set up the email like this:
adding the first email as main recipient
adding all others to the cclist
Is there a way to set up the email so atleast the other recipients are getting the email?
Some Infos:
Delphi 7
Indy 10
Thanks in advance <3
TIdSMTP has an OnFailedRecipient event:
type
TIdSMTPFailedRecipient = procedure(Sender: TObject; const AAddress, ACode, AText: String;
var VContinue: Boolean) of object;
AAddress is the email address, and ACode and AText contain the error details.
If VContinue is set to True (the default when OnFailedRecipient is assigned), the failed email is skipped and the next recipient is attempted.
The EIdSMTPReplyError exception is raised if either:
OnFailedRecipient is not assigned when a recipient fails.
VContinue is set to False.
all recipients fail, regardless of OnFailedRecipient.
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.