LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 08-15-2012, 10:37 AM   #1
qwertyjjj
Senior Member
 
Registered: Jul 2009
Location: UK
Distribution: Cent OS5 with Plesk
Posts: 1,013

Rep: Reputation: 30
use remote smtp server?


I have a server that send out mail using PHP's mail, Linux sendmail, maybe postfix, and nail.
How can I change all of these processes so that they use a registered smtp server with correct MX records to ensure that the mail is not delivered to junk especially if it HTML email?
 
Old 08-15-2012, 04:02 PM   #2
Kenarkies
Member
 
Registered: Nov 2007
Location: South Australia
Distribution: Ubuntu 11.10
Posts: 81

Rep: Reputation: 23
I sort of understand why you want to make a change, but your post is a bit vague about how email is sent. Are you using several clients connecting to a local SMTP server on your machine/network? Or are you using a server provided off-site (ISP etc)? If you are using a local server and your IP address is not static, your email is unlikely to be delivered at all. Please elaborate.

cheers, Ken
 
Old 08-15-2012, 04:45 PM   #3
choronozon
LQ Newbie
 
Registered: Mar 2009
Distribution: Debian lenny & squeeze servers. Mint 13 and 14 desktops
Posts: 16

Rep: Reputation: 2
any SMTP relay can be directed to use an upstream ISP relay instead of going direct - see the documentation for whatever SMTP installation you have.
 
Old 08-15-2012, 08:39 PM   #4
padeen
Member
 
Registered: Sep 2009
Location: Perth, W.A.
Distribution: Slackware, Debian, Gentoo, FreeBSD, OpenBSD
Posts: 208

Rep: Reputation: 41
Also, no matter how you set up yours and your upstream servers, you have no control over whether something in the chain flags the message as junk. That happens at the recipient's mail application, and possibly their immediate upstream mail provider (my ISP runs a spam detector on any mail they deliver to me).

The answer is, of course, to write mail that doesn't appear to be spam.
 
Old 08-15-2012, 09:56 PM   #5
linjoy42
LQ Newbie
 
Registered: Jul 2011
Posts: 3

Rep: Reputation: Disabled
If you are looking for a way to do this without reconfiguring the serverwide smtp settings, you can use the php Pear mail package instead of the built in mail command
 
Old 08-16-2012, 03:18 AM   #6
choronozon
LQ Newbie
 
Registered: Mar 2009
Distribution: Debian lenny & squeeze servers. Mint 13 and 14 desktops
Posts: 16

Rep: Reputation: 2
Quote:
Originally Posted by padeen View Post
Also, no matter how you set up yours and your upstream servers, you have no control over whether something in the chain flags the message as junk. That happens at the recipient's mail application, and possibly their immediate upstream mail provider (my ISP runs a spam detector on any mail they deliver to me).

The answer is, of course, to write mail that doesn't appear to be spam.

well yes and no. Filters like spamhaus will check the source IP address for blacklisting. Using a relay avoids that.
 
Old 08-16-2012, 04:23 AM   #7
jgm27
LQ Newbie
 
Registered: Jul 2012
Posts: 6

Rep: Reputation: Disabled
I use Blat which was very easy for a Linux newbie like me to set up to use my own smtp server.
Regards,
John
 
Old 08-16-2012, 04:38 AM   #8
qwertyjjj
Senior Member
 
Registered: Jul 2009
Location: UK
Distribution: Cent OS5 with Plesk
Posts: 1,013

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by Kenarkies View Post
I sort of understand why you want to make a change, but your post is a bit vague about how email is sent. Are you using several clients connecting to a local SMTP server on your machine/network? Or are you using a server provided off-site (ISP etc)? If you are using a local server and your IP address is not static, your email is unlikely to be delivered at all. Please elaborate.

cheers, Ken
At present I send mail using the local Linux box, which is just an IP address, not registered with any domains and no MX records. The mail comes from name@mydomain.com
So, the mails get delivered (to most ISPs) but delivered as junk or not delivered at all (AOL, etc). I have access to a smtp server with the actual domain and proper MX records of mydomain.com but it is on a different remote server.

Quote:
Originally Posted by padeen View Post
Also, no matter how you set up yours and your upstream servers, you have no control over whether something in the chain flags the message as junk. That happens at the recipient's mail application, and possibly their immediate upstream mail provider (my ISP runs a spam detector on any mail they deliver to me).

The answer is, of course, to write mail that doesn't appear to be spam.
It is picked up as spam because of the non MX records on the local server. Not all HTML email is picked up as spam is it?

Quote:
Originally Posted by linjoy42 View Post
If you are looking for a way to do this without reconfiguring the serverwide smtp settings, you can use the php Pear mail package instead of the built in mail command
But that is only PHP, what about perl scripts, nail, postfix, sendmail, etc.?

Quote:
Originally Posted by choronozon View Post
well yes and no. Filters like spamhaus will check the source IP address for blacklisting. Using a relay avoids that.
Exactly, see MX record issue above and the domain name.

Quote:
Originally Posted by jgm27 View Post
I use Blat which was very easy for a Linux newbie like me to set up to use my own smtp server.
Regards,
John
Won't help as the smtp server will be on the local box then but it is still only an ip address. The registered mydomain.com is on a different remote server. So, any mail sent from the local box with name@mydomain.com as the from address will be picked up with incorrect MX records ebcause it is not sent from mydomain.com but sent from 86.IP.IP.IP
 
Old 08-16-2012, 04:59 AM   #9
jgm27
LQ Newbie
 
Registered: Jul 2012
Posts: 6

Rep: Reputation: Disabled
Wouldn't it be simpler just to buy a domain for a few dollars a year and apply this to your server or use your domain provider to set up a sub domain.
Regards,
John
 
Old 08-16-2012, 05:52 AM   #10
Kenarkies
Member
 
Registered: Nov 2007
Location: South Australia
Distribution: Ubuntu 11.10
Posts: 81

Rep: Reputation: 23
It's unlikely to be the lack of DNS MX records causing non-delivery. Most likely you have a dynamic address from your ISP unless you have specifically bought a static address, and as such external SMTP servers will not relay or deliver anything sent from that address, even if you have a domain name. Make sure you have a static address (if you can get one now since IP4 has run out of addresses AFAIK). Then you can get a free domain name from someone like DynDNS, if you are happy with their kinky offerings.

On the other hand your ISP should almost certainly provide an SMTP server which will be happy with relaying your mail as you will have been authenticated with them when setting up the connection.

I'm pretty sure you can receive mail directly to your machine (rather than through the ISP's POP3 or IMAP4 servers) even with a dynamic IP address, as DNS servers like DynDNS will follow changes to your address. However you will need to setup a complex mailserver to handle it. A lot of work!

cheers, Ken
 
Old 08-16-2012, 07:51 AM   #11
qwertyjjj
Senior Member
 
Registered: Jul 2009
Location: UK
Distribution: Cent OS5 with Plesk
Posts: 1,013

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by Kenarkies View Post
It's unlikely to be the lack of DNS MX records causing non-delivery. Most likely you have a dynamic address from your ISP unless you have specifically bought a static address, and as such external SMTP servers will not relay or deliver anything sent from that address, even if you have a domain name. Make sure you have a static address (if you can get one now since IP4 has run out of addresses AFAIK). Then you can get a free domain name from someone like DynDNS, if you are happy with their kinky offerings.

On the other hand your ISP should almost certainly provide an SMTP server which will be happy with relaying your mail as you will have been authenticated with them when setting up the connection.

I'm pretty sure you can receive mail directly to your machine (rather than through the ISP's POP3 or IMAP4 servers) even with a dynamic IP address, as DNS servers like DynDNS will follow changes to your address. However you will need to setup a complex mailserver to handle it. A lot of work!

cheers, Ken

The mail is delivered, it just goes to junk as it comes from an unrecognised domain. Some ISPs block it completely eg AOL as they do an MX check.
Yes, the ISP has an smtp server that I want to use but I don't know how to change sendmail, PHP mail, postfix, and nail as per OP

Quote:
Originally Posted by jgm27 View Post
Wouldn't it be simpler just to buy a domain for a few dollars a year and apply this to your server or use your domain provider to set up a sub domain.
Regards,
John
I already have a domain but the domain is linked to a webserver at the hosting company.
mydomain.com running at the webs server host
MX records at hosting company have stmp.hosting.com access
justanip.address.x.x @ separate dedicated server running other functions

So, there are 3 separate servers at different locations (web server, smtp server, local server)

I could buy another domain name to run on the local server but then they would receive mail from slightyldifferent-mydomain.com not mydomain.com
I could add a webserver and smtp on the local server too but I don't want to at the moment for performance and it would be a lot of effort to move files and DNS settings.

Last edited by qwertyjjj; 08-16-2012 at 07:54 AM.
 
Old 08-16-2012, 08:17 AM   #12
Linuxmonger
LQ Newbie
 
Registered: Jun 2011
Posts: 5

Rep: Reputation: Disabled
send via SMTP relay

First, find out what your primary server is running with telnet;
telnet localhost 25

Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
220 mail.somedomain.com ESMTP Postfix
quit
221 2.0.0 Bye
Connection closed by foreign host.

In this case it's Postfix (see it in the output?)

Add a line in /etc/postfix/main.cf
relayhost = [my.relay.host.org]
And yes, the square brackets are supposed to be there.

Restart Postfix with /etc/init.d/postfix restart

And all should be good - adjust paths to files to suit your distribution, and if you need more assistance, please post the result of your telnet session
 
Old 08-16-2012, 08:33 AM   #13
qwertyjjj
Senior Member
 
Registered: Jul 2009
Location: UK
Distribution: Cent OS5 with Plesk
Posts: 1,013

Original Poster
Rep: Reputation: 30
edit

Last edited by qwertyjjj; 08-16-2012 at 08:43 AM.
 
Old 08-16-2012, 01:33 PM   #14
Linuxmonger
LQ Newbie
 
Registered: Jun 2011
Posts: 5

Rep: Reputation: Disabled
More on my previous post

I'm not sure how php-mail works, but I had made an assumption that all of the mail was directed at the machine without the proper DNS entries. Nail for certain works nicely with localhost as the SMTP server, and if everything is local, it's simple to then have the local machine forward to an upstream mx. Don't forget to tell the upstream mx that you will be relaying to it, and add a forward or two so you can receive reply and bounce messages.
 
Old 08-17-2012, 03:33 AM   #15
Kenarkies
Member
 
Registered: Nov 2007
Location: South Australia
Distribution: Ubuntu 11.10
Posts: 81

Rep: Reputation: 23
Quote:
Originally Posted by qwertyjjj View Post
The mail is delivered, it just goes to junk as it comes from an unrecognised domain. Some ISPs block it completely eg AOL as they do an MX check.
Yes, the ISP has an smtp server that I want to use but I don't know how to change sendmail, PHP mail, postfix, and nail as per OP
OK that makes sense, they will use all and any checks to filter out potential undesirable stuff.

So I guess it reduces to GIYF (Google is your friend). e.g. for sendmail there is http://cri.ch/linux/docs/sk0009.html as an example, and others as well. It's just a matter of ploughing through the arcane Linux config files with the help of those who suffered before us. Using your own ISP is easy as they know who you are and will relay without hassles. You won't need a domain name.

Quote:
I could buy another domain name to run on the local server but then they would receive mail from slightyldifferent-mydomain.com not mydomain.com
If you are going to run an SMTP server on your local machine (like sendmail or postfix), get any name at all from a company like DynDNS (no charge for one or two) and the receiving machines should be satisfied. It won't affect the actual domain name used for receiving your mail. For that you should be able to set your domain's MX record to point to your machine. How and whether it can be done will depend on your hosting site. Again that will need your machine to have a name.

Ken
 
  


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
Remote SMTP Server Returned: 553 error yeayu Linux - Server 4 10-05-2011 07:39 AM
Does fdm is able to deliver a mail through remote smtp server? igadoter Linux - Networking 0 09-02-2011 05:34 AM
[SOLVED] configure postfix to connect to remote smtp server mrpurple Linux - Software 5 03-17-2011 10:30 AM
relaying SMTP-server using authentication on a remote server using IMAP frater Programming 2 10-04-2010 01:55 AM
using sendmail to forward to a remote smtp server selgip Linux - Software 1 03-21-2005 05:04 PM

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

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