How to use sendmail to send email alerts through Outlook?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to use sendmail to send email alerts through Outlook?
I bought a Raspberry Pi for work to monitor some of our machines.
I wrote a bash script using sendmail to automatically send an alert email whenever one of them goes down/loses connection. The office uses MS Outlook for it's email service.
The issue I'm having is the email from the Pi keeps getting rejected as spam from the server, so I can't actually send out any emails. The server sends back a "Diagnostic-Code: SMTP; 550 5.7.606 Access denied, banned sending IP..." along with a ton of other code to the Pi telling it "No." The email is being sent from the local host, the Pi, and I'm pretty sure that's part of the problem.
I've tried adding the server name to the sendmail.mc file, using "define('SMART_HOST',my.server.com)dnl", but I don't really know enough to pin down what I should do. Some Googling has led to some other solutions, but nothing has worked so far.
My boiled down question (I think) is how do I get the email to send from the server instead of the Raspberry Pi? Or at least get the server to allow it to send without getting the Pi's IP address off the spam list.
Whoever administers your MS Exchange or MS Office365 mail has to allow the relay from the IP. As you might imagine by default most mail systems (even those from MS) by default reject relaying unless explicitly allowed.
You could send directly to the internet rather than relaying through MS Exchange/Office 365.
However, that would likely require you to do additional DNS setup regarding your domain. If you already have SPF or TXT records restricting which servers can send on behalf of your domain others would reject you until you added the outbound IP of the sendmail server to those records. Additionally others often reject if you don't have a valid (in their mind) PTR showing the IP resolves to a "real" name. (e.g. We used to have PTRs that simply pointed back to text with the IP in it but some companies rejected those as being "generic". Early on we didn't care but more and more people do that so we finally put in PTRs that give the same name as the forward lookup.)
It might also require whoever does your firewall device setup to allow your sending server to send out over mail ports. As you might imagine that is typically NOT allowed so as to prevent random workstations from getting infected and becoming spambots. Once your domain is flagged as a spam sender the various sites that blacklist will list your entire domain and not just the IP that began spamming.
These days we do actually have a Sendmail server we relay to for one sending domain to separate its traffic from our main domain. Most of our email however, still relays via Office 365 instead using our main domain.
Last edited by MensaWater; 10-05-2017 at 04:02 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.