LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 10-02-2017, 05:28 PM   #1
pcarlso7
LQ Newbie
 
Registered: Oct 2017
Posts: 5

Rep: Reputation: Disabled
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.
 
Old 10-04-2017, 09:17 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
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.
 
Old 10-05-2017, 01:14 PM   #3
pcarlso7
LQ Newbie
 
Registered: Oct 2017
Posts: 5

Original Poster
Rep: Reputation: Disabled
Thanks, that's what I ended up doing. Now I'm trying to fix the hostname issues, but that's a topic for another day.

Out of curiosity, do you know of another way to get the email through?
 
Old 10-05-2017, 01:35 PM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
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.
 
1 members found this post helpful.
Old 10-05-2017, 01:38 PM   #5
pcarlso7
LQ Newbie
 
Registered: Oct 2017
Posts: 5

Original Poster
Rep: Reputation: Disabled
Awesome, that makes sense. And also, fair enough. I appreciate the replies!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to send email alerts when someone logs onto server? tearsforhari Linux - Newbie 13 07-17-2015 06:20 PM
Looking for Public IP address monitor that can send email alerts 5circles Linux - Software 2 07-11-2009 08:21 PM
Nagios plugin wont send email alerts investmentbnker75 Programming 0 11-18-2008 08:49 AM
Sendmail/Outlook problem (receiving is ok but cannot send) custangro Linux - Server 1 07-17-2007 12:23 AM
how to make a C program send email notification/alerts? eigenyeugen Programming 1 01-04-2005 08:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration