LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-16-2009, 09:48 AM   #1
tim914
Member
 
Registered: Apr 2005
Location: Scottsdale, AZ USA
Distribution: Most of them :-)
Posts: 37

Rep: Reputation: 15
Question Using 'mail' in a script to send mail on an alternate port?


Hi Folks,

I'm working on a script to help Linux desktop users mange certain aspects of their desktop systems. Part of the script sends an email to a specified recipient on certain discoveries. This script works fine if the user's system is able to communicate with the mail server on port 25, but many users are now communicating with servers over alternate ports (the server listens for mail on a port other than 25 - Apple's mac.com server, for example).

Is it possible to tell the mail or mailx tool to use an alternate port? Or, is there another built-in command line mail tool that can send mail on an alternate port (the local system might not have the mail server process configured or running)?

Thanks,
Tim
 
Old 01-16-2009, 10:06 AM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 270Reputation: 270Reputation: 270
Well, all standard SMTP or MX records will use port 25 for mail delivery. It's not up to your mail client to pick the port of the mail server on the recieving end. When you use the mail or mailx command, it's using the local machine or server on port 25 to send the email out.

If you take a closer look at mac.com, it's just an alias for these MX records or hosts handling the mail which all listen on port 25 as I was able to telnet to each:

Code:
trickykid@myserver:~$ host mac.com
mac.com has address 17.250.248.32
mac.com mail is handled by 10 smtp-mx1.mac.com.
mac.com mail is handled by 10 smtp-mx2.mac.com.
mac.com mail is handled by 10 smtp-mx3.mac.com.
mac.com mail is handled by 10 smtp-mx4.mac.com.
mac.com mail is handled by 10 smtp-mx5.mac.com.
mac.com mail is handled by 10 smtp-mx6.mac.com.
 
Old 01-16-2009, 10:36 AM   #3
tim914
Member
 
Registered: Apr 2005
Location: Scottsdale, AZ USA
Distribution: Most of them :-)
Posts: 37

Original Poster
Rep: Reputation: 15
Thumbs down I think you didn't understand what I was asking ...

Quote:
Originally Posted by trickykid View Post
If you take a closer look at mac.com, it's just an alias for these MX records or hosts handling the mail which all listen on port 25 as I was able to telnet to each
I never claimed that they didn't accept port 25 connections. However, many home users are connected via ISP's that block port 25 for all the right reasons. For these, Apple and others allow connection via port 587 (or 465 as a legacy alternate). This is where I'm coming from.

More relevant ideas?

Tim
 
Old 01-16-2009, 02:35 PM   #4
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 270Reputation: 270Reputation: 270
Quote:
Originally Posted by tim914 View Post
I never claimed that they didn't accept port 25 connections. However, many home users are connected via ISP's that block port 25 for all the right reasons. For these, Apple and others allow connection via port 587 (or 465 as a legacy alternate). This is where I'm coming from.

More relevant ideas?

Tim
Well yeah, for good reason to not allow users to have mail servers that are potential hosts to serve up spam.

Incoming is usually blocked but not outgoing. You should rewrite your rules so you're local box just sends the email through your ISP's SMTP provided server to send emails in this type of case.
 
Old 01-16-2009, 03:23 PM   #5
tim914
Member
 
Registered: Apr 2005
Location: Scottsdale, AZ USA
Distribution: Most of them :-)
Posts: 37

Original Poster
Rep: Reputation: 15
I don't want to sound ungrateful, but I don't think that you understand what I'm asking.

Regardless of right or wrong (I think it's right), many smart ISP's block port 25 outbound as well as inbound to prevent users' computers that have become members of botnets from sending mail directly. It's more than just preventing the running of server services in non-business grade accounts.

Ah well, I just wrote my own tool to handle it properly and will include it with the script.

Tim

Last edited by tim914; 01-16-2009 at 03:24 PM. Reason: Apostrophe in the wrong place
 
  


Reply

Tags
alternate, mail, port, smtp


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
can mail command be used to send mail onto global mail servers like yahoo etc dale_chip Linux - Newbie 4 08-12-2008 08:33 AM
with the linux proxi, backend pop3 mail client can not receive mail and send mail rubin823 Linux - Networking 0 12-21-2006 10:06 PM
Send mail through script aabfm Linux - Networking 5 07-01-2006 04:46 AM
Shel script mail send ("/" in mail address) problem anaid Linux - Networking 3 08-23-2005 07:41 AM
CGI Script runs to send mail, but mail is never sent robertwo Linux - Newbie 2 06-10-2004 09:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:55 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