Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Fri Oct 07, 2011 11:06 am 
Offline
Junior Member

Joined: Mon Oct 03, 2011 1:09 pm
Posts: 29
System: Ubuntu 10.04

OK, based on my fail with the send-only Exim issue, I'm obviously n00b about installing email solutions. So let's start from the beginning.


I'm looking for the simplest install that will allow my mail() commands to work. I don't need a full blown send/receive/calendar/lollipopholder. Receiving our emails is already dealt with.

Looking at the email guides (multiple installs of postfix, citadel, etc. etc.) I've already tried basic Postfix and Exim installs, and failed with both.

So what's the cleanest solution to my problem? Any recommendations.


Top
   
 Post subject:
PostPosted: Fri Oct 07, 2011 11:13 am 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
I'll use Postfix in this example, because that's what I'm used to:

1. Remove all other e-mail sending programs, like exim and sendmail-mta. Afterward, run "top" or to verify that these programs are not running. Sometimes they keep running even after you remove them.

2. Run the following commands, one by one. Don't copy and paste all three lines at the same time. If Postfix asks questions, just keep pressing Enter.
Code:
apt-get install --reinstall postfix
postconf -e "inet_interfaces = loopback-only"
/etc/init.d/postfix restart

3. There is no step 3.

Edit: clarification in step 2.


Top
   
 Post subject:
PostPosted: Fri Oct 07, 2011 12:54 pm 
Offline
Junior Member

Joined: Fri Dec 12, 2008 1:24 pm
Posts: 23
Or install ssmtp:

sudo apt-get install ssmtp

See: http://www.scottro.net/qnd/qnd-ssmtp.html


Top
   
 Post subject:
PostPosted: Mon Oct 10, 2011 12:23 pm 
Offline
Junior Member

Joined: Mon Oct 03, 2011 1:09 pm
Posts: 29
hybinet & melz trying both of your methods, I can get mail() to send to a gmail or yahoo account, but can't get any email sent to me@mysite.com

Which places me in the same problem I was having using the send-only Exim attempt.

Quite simply, I'd like to be able to make a contact page that can send us an internal email. Once that's done, I'm ASSuming sending automated emails via website to customers will be easy also. (Seems the 2nd part is the easiest. Not sure why the 1st part's such a pain.)

Anybody?


Top
   
 Post subject:
PostPosted: Mon Oct 10, 2011 1:54 pm 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
You said that you had receiving emails "already dealt with". Is mysite.com the same domain you're talking about?

What does Postfix (or exim, or ssmpt) think its hostname is? If it is the same as mysite.com, that could be the reason why it's not properly handling e-mails bound to mysite.com.

If you used Postfix as I suggested, relevant entries can be found in /etc/postfix/main.cf in the "myhostname" and "mydestination" lines, as well as in /etc/mailname. Not sure where they are in ssmtp.

If mysite.com is in there, try changing it to a subdomain (such as mail.mysite.com), or something unrelated to the domain (such as the default reverse DNS entry of liXX-YYY.members.linode.com). Obviously, you should use a subdomain that actually points to your IP address. Wait until the DNS propagates, restart Postfix and try again.


Top
   
 Post subject:
PostPosted: Mon Oct 10, 2011 5:46 pm 
Offline
Junior Member

Joined: Mon Oct 03, 2011 1:09 pm
Posts: 29
Tried both mail.mysite.com and xxx.linode.com per above on both ssmtp and postfix. Still the same problem.

I can kind of see the problem. Our normal me@mysite.com emails are routed through a different location than the website. Godaddy & Linode (Don't hate me. Bosses choice. :lol:) So of course mysite.com emails originating from the website are getting spooled for local delivery that doesn't exist.

So how best to jump this hurdle? Just set the mailbox/hostname settings to Godaddy?


Top
   
 Post subject:
PostPosted: Mon Oct 10, 2011 6:44 pm 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
What do the following commands return:

hostname
hostname -f
cat /etc/hosts
telnet localhost 25

... as well as 'dig -x 192.0.2.1', with your IP address instead of the example IP?

If ANY of them (or your mail server's configuration file) have your bare domain name (mysite.com), that is your problem. A mail server will not try to connect to a mail server for mysite.com if it thinks it is mysite.com, and there is nothing you can do aside from make sure nothing on your system would lead it to believe it is mysite.com.

Also, if that was the case and you did change your hostname, a reboot is sometimes helpful to get everything on the same page.

_________________
Code:
/* TODO: need to add signature to posts */


Top
   
 Post subject:
PostPosted: Tue Oct 11, 2011 10:19 am 
Offline
Junior Member

Joined: Mon Oct 03, 2011 1:09 pm
Posts: 29
hoopycat wrote:
If ANY of them (or your mail server's configuration file) have your bare domain name (mysite.com), that is your problem.


Yeah that's obviously the problem I'm running into. However, if I change the hostname, what's the easiest way to do it so that I don't break every other portion of my website? (I.E. every app where the config files points to the "current" hostname)


Top
   
 Post subject:
PostPosted: Tue Oct 11, 2011 12:37 pm 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
josh-chs wrote:
However, if I change the hostname, what's the easiest way to do it so that I don't break every other portion of my website? (I.E. every app where the config files points to the "current" hostname)

Generally speaking, web servers and web apps don't give a damn about the hostname of the machine they're on. For example, if you have a <VirtualHost> with ServerName mysite.com and ServerAlias www.mysite.com, it will continue to work just fine after you've changed your hostname.

On Debian & Ubuntu systems, you can change the hostname by:

Step 1. Edit /etc/hostname (just type your new hostname and save)
Step 2. /etc/init.d/hostname.sh start
Step 3. Edit /etc/hosts (change any entries pointing to the old hostname)

Make sure you use a fully qualified domain name as your hostname, e.g. "subdomain.example.com" instead of "subdomain".


Top
   
 Post subject:
PostPosted: Tue Oct 11, 2011 12:54 pm 
Offline
Junior Member

Joined: Mon Oct 03, 2011 1:09 pm
Posts: 29
So in this case, I can make hostname = Janus and FQDN = janus.site.com ?

So, in this example:
Step 1. Edit /etc/hostname janus
Step 2. /etc/init.d/hostname.sh start
Step 3. Edit /etc/hosts (change any entries to janus.site.com)

And this would help clear my email problem, without causing problems w/ SQL, etc.? (well SQL bad example, but you get what I mean)


Top
   
 Post subject:
PostPosted: Tue Oct 11, 2011 5:41 pm 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
Yes, that would do. (You could also put the FQDN in the hostname.)

In /etc/hosts, only change entries that actually contains site.com. Leave other entries alone, e.g. localhost and IPv6 settings.

SQL doesn't care. Your web app only ever connects to localhost, right?


Top
   
 Post subject:
PostPosted: Wed Oct 12, 2011 11:07 am 
Offline
Junior Member

Joined: Mon Oct 03, 2011 1:09 pm
Posts: 29
hybinet wrote:
Your web app only ever connects to localhost, right?


Great question. I've only recently inherited this site, and haven't been able to comb through it completely yet.

In short, no clue.


Top
   
 Post subject: Thank you
PostPosted: Sun Dec 04, 2011 12:45 am 
Offline
Senior Newbie

Joined: Thu Nov 17, 2011 6:20 pm
Posts: 7
hybinet wrote:
I'll use Postfix in this example, because that's what I'm used to:

1. Remove all other e-mail sending programs, like exim and sendmail-mta. Afterward, run "top" or to verify that these programs are not running. Sometimes they keep running even after you remove them.

2. Run the following commands, one by one. Don't copy and paste all three lines at the same time. If Postfix asks questions, just keep pressing Enter.
Code:
apt-get install --reinstall postfix
postconf -e "inet_interfaces = loopback-only"
/etc/init.d/postfix restart

3. There is no step 3.

Edit: clarification in step 2.


I just wanted to say thank you for posting these steps. Like OP, I was also looking for a simple program to send emails and didn't need to configure anything fancy (mysql, dovecot etc) since I'm using Google Apps for emails. I followed your steps and it worked great!


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group