How to block sending outgoing mail from other domains in from field - postfix-mta

In my postfix mail server, users are able to send mail on name of different domains
using from field in mail client software.
For eg. I am using sendEmail mail client, and I can send emails with hdfc.com domain or other too,
sendEmail -v -f "amit#hdfc.com" -s "test.example.in:25" -xu "amit" -xp "ami*321" -t "xyz#yahoo.co.in" -u "test from sendEmaili 0255" -m "this is sendEmail test"
This mail goes to spam and it did not show actual mail address in details header.
How Can I restrict my outgoing mails such that it can only send outgoing mails which have my domain test.example.in? or it would be great if I can map user's too that user can't use other users name.
If only first case work that will be sufficient for me.
I searched a lot but not able to do this. my postfix version is 2.11.3-1 on debian Jessie. My setup have just postfix with sasl authentication, authentication is working fine.
--
Thanks

To block from address which don't match with user email account, below line did the magic. Add this in main.cf
smtpd_sender_restrictions = reject_sender_login_mismatch, permit_sasl_authenticated
To map system users to email address
add the line in main.conf
below file we used to map system users to email address
smtpd_sender_login_maps = hash:/etc/postfix/envelope_senders
Map the system user to email address in /etc/postfix/envelope_senders file, amit is my system user
amit#test.example.in amit
Run the below command, you can add other system users too, whenever you edit this file, you have to run below command and reload the postfix
postmap /etc/postfix/envelope_senders
and reload postfix
postfix reload
it's done, now no one can use other email address than amit#test.example.in in from field, if he tried to use anything it will reject the email.

Related

Dkim on multiple domains as mailchimp does

I actually have a server with a email marketing app just like mailchimp.
Each user have their own email added to my app. I want to send a email campaign with the clients email from my own server but signed with dkim email.
In mailchimp the only thing that you do is type your email on a field and the emails are sended signed.
Im using postfix as server email and php for app, any advice please?
You can use OpenDKIM and setup a milter config in postfix and that will send outgoing messages that are defined in the configuration.

How do I connect a SMTP with Firebase?

Instead of using the built-in email system in Firebase, I wanted to use a SMTP called SMTP2Go but was wondering how to connect it and if need to buy my own email domain first or not? What requirements are needed to connect a SMTP to Firebase?
I assume you're trying to set up a custom SMTP server for sending (verification, password reset, email change) emails from Firebase Authentication. You can set a custom SMTP server in the Firebase Authentication console.
You don't need a custom domain for this. All you need to know is the SMTP host and port of SMTP2GO (something like mail.smtp2go.com and 587), and your account details from them (the username/password you use to log into smtp2go with).
The Sender address field is just what recipients see in the "From" field of the email, and also where any replies they send will be going. It can be whatever address you want to use to support your users.
If you would like to use the Gmail account as SMTP service for Firebase following steps might help you with that. I have shared a medium post about it if you would like to have more details.
Enable the 2 step verification for the G Suite account.
Create an app password for the account.
Allow users to manage their access to less secure apps
Unlock the captcha
The G-Suite account is ready to be used as an SMTP service for firebase.
Check this link please for more details.

Gmail cannot receive wordpress email

I trying to send email to my gmail, but I cannot see the email in my gmail. I also tried to send the email to my hotmail, it is working when send to hotmail.
How do I fix this problem?
Thanks
Today, email service providers are very string with spam. I think your mail that you sended with wordpress is in your Gmail spam folder. You're maybe sending it from localhost or something like that. So Gmail put it by default to the spam folder. You can recover that by mapping a public domain name on your smtp server or like #raman-kuman's answer, you can use a plugin like Postman SMTP plugin to configure an email service like Gmail or Hotmail. If you use another famous email service, you can maybe find the settings here.
I would highly recommend you to use a personal mail server, so you can personalize your email like:
no-reply#my-awesome-domain.name for a notification
contact#my-awesome-domain.name for contact
...
It's looks better than my-awesome-company#gmail.com.
It's most likely to do with :
1.) Your SMTP relaying settings within Wordpress. Check how it's configured and post a new question if you're struggling to get them to work. If your using a SMTP relay service then confirm these credentials are correct.
2.) The email address you are sending out as. If your sending as GMAIL or Hotmail e.g. administrator#hotmail.com from Wordpress using the PHP to send mail then it maybe be sending the mail from the IP address of your webserver which will not be part of the Hotmail/Gmails SPF record so recipient servers would block you on connection.
Make sure your email address that is sending from WordPress is the same as your domain name - something like wordpress#yourwebsite.com, otherwise use the Postman plugin, it will take a bit of configuration but you will be able to send to anywhere.
You can use Gmail's SMTP using Postman SMTP plugin, it works for all..

Alfresco how to send email to other domain

I have configured the alfresco email outbound like this
mail.host=mailserver.com
mail.port=25
mail.username=uname
mail.password=pword
now I can send mail to email address like abc#mailserver.com but abc#otherdomain.com.
how to send email to other domai? thanks!!!(my alfresco edition is community 4.2.x)
Promoting a comment to an answer...
Alfresco itself has absolutely no problems with sending emails to any destination domain
However, when you setup outbound SMTP for Alfresco, you specify a mail server to use for handling outbound messages. That server needs to be configured to allow mail relaying from the Alfresco host. If it isn't, then you'll often see that internal emails are fine, but external emails are rejected. Make sure your mail server is configured to allow Alfresco to send (relay) emails through it, and you'll be fine!
To send an email to alfresco using the rule “Send an email to a specified user“ you must modify first the file alfresco-global.properties. This file is located in the folder “tomcatsharedclasses“.
mail.host=your host
mail.port=25
mail.username=your mail user
mail.password=your mail password
mail.encoding=UTF-8
mail.from.default=optional name
mail.smtp.auth=true
Finally, you can change the template of email notification in the file notify_user_email.ftl in Company Home/Data Dictionary/Email Templates/Notify Email Templates.
For complete example see here:
https://lentux-informatica.com/how-to-send-email-through-alfresco/

ASP.NET SMTP and Gmail

The question: Is it possible to configure multiple SMTP servers or update the SMTP object server information at runtime?
Description of problem: The site I'm working on has a few pages which send emails. Our site is using Gmail so even though it's a custom domain our email is sent out though Gmail SMTP servers.
Some emails come from the system and some emails come from users in certain groups. I have an SMTP server configured with the admin email for the system e.g. admin#mysite.com This works fine and when I get the email it shows from admin#mysite.com
One of our user groups let's call it "groupA" has an email configured on our domain i.e. groupA#mysite.com When I send the email and specify a from address for the MailMessage object as groupA#mysite.com it still shows up in my outlook as coming from admin#mysite.com I did a little further testing and if I specify both the from address and the ReplyTo as groupA#mysite.com it will show as From=admin#mysite.com but when I choose reply in outlook it shows groupA#mysite.com My best guess is that Gmail is overwriting the From address with the SMTP user to prevent email spoofing.
I found this: http://www.systemnetmail.com/faq/4.1.aspx but it won't work for me since group A, B, and C all need to send emails from the same page.
To my knowledge, it's impossible to fake the "from" address when using gmail.
Even if you use apps premiere, and set up address aliases, it still says "sent on behalf of ".
system.net.mail configuration in web.config only supports one config
you can easily create your own custom config and configure email server settings at runtime, like so:
SmtpClient smtp = new SmtpClient("smtp.gmail.com");
smtp.Port = 465;
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
smtp.UserCredentials = new System.Net.NetworkCredential("yourusername", "yourpassword");
smtp.Send(mail);
you can obviously store yourusername and yourpassword in app settings

Resources