LinuxQuestions.org
Help answer threads with 0 replies.
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 11-24-2008, 12:57 PM   #1
globalpiece
LQ Newbie
 
Registered: Nov 2008
Posts: 4

Rep: Reputation: 0
Directing email from web forms to MX server


Hi,

My website is hosted on a linux box and my email is hosted externally on an exchange server. All MX records have been changed so that if anyone sends email to an email (ie. to anyone@mysite.com) it will be receive through the exchange server.

however, i have contact form on my website that worked before i set up the exchange server but does not work now. i am guessing this is because the webform is sending mail locally on the linux box - but i am not sure.

i've tried googling a solution to this but haven't had much luck. can anyone shed some light on this problem? somehow i need to make the mail coming from my website's contact form to info@mysite.com get sent to the exchange server and not kept locally on the linux box.

Thanks.
 
Old 11-24-2008, 02:08 PM   #2
djsoundfx
Member
 
Registered: May 2008
Distribution: Gentoo, Ubuntu, RHEL, CentOS, BSD, Solaris
Posts: 82

Rep: Reputation: 23
What was handling the email from the website before? Postfix, sendmail?

Different daemons will have different solutions to the problem. It could be as easy as updating your aliases ( /etc/aliases ) to contain:

user: user@yourexchangeserver

and this will forward the mail for you rather than holding it locally.

If its sendmail there's a few different options you have depending on what you want the end result to be.
 
Old 11-24-2008, 02:10 PM   #3
djsoundfx
Member
 
Registered: May 2008
Distribution: Gentoo, Ubuntu, RHEL, CentOS, BSD, Solaris
Posts: 82

Rep: Reputation: 23
Also it may be useful, if you have access, to see where the mail is going...
(be root or sudo this command)
tail -f /var/log/maillog

then send an email from the contact page on your website, and post those results here.
 
Old 11-24-2008, 03:08 PM   #4
globalpiece
LQ Newbie
 
Registered: Nov 2008
Posts: 4

Original Poster
Rep: Reputation: 0
hi thanks for the reply. sendmail is active on my server.

the contact for on my website sends an email to info@myURL.com. info is not setup as a local user. in the future there may be other pages on the site that will send email to other emailaddresses@mysite.com. i would like any email sent from the website to NOT be treated as local. i want any emails to be sent to the exchange server.

i did as you instructed and this is the result:

Nov 24 14:57:33 christopherlacass sendmail[697]: mAOKvXJW000697: from=apache, size=548, class=0, nrcpts=1, msgid=<200811242057.mAOKvXJW000697@christopherlacass.com>, relay=apache@localhost
Nov 24 14:57:34 christopherlacass sendmail[702]: mAOKvXEm000702: from=<apache@christopherlacass.com>, size=784, class=0, nrcpts=1, msgid=<200811242057.mAOKvXJW000697@christopherlacass.com>, proto=ESMTP, daemon=MTA, relay=fc2 [127.0.0.1]

Nov 24 14:57:34 christopherlacass sendmail[697]: mAOKvXJW000697: to=info@christopherlacass.com, ctladdr=apache (48/48), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30548, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (mAOKvXEm000702 Message accepted for delivery)

Nov 24 14:57:34 christopherlacass sendmail[703]: mAOKvXEm000702: to=root, ctladdr=<apache@christopherlacass.com> (48/48), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31003, dsn=2.0.0, stat=Sent


thanks again...looking forward to your advice.
 
Old 11-24-2008, 03:44 PM   #5
aenright
Member
 
Registered: May 2005
Location: San Antonio, TX
Distribution: CentOS/Fedora/RHEL/FreeBSD/HPUX/Solaris
Posts: 46

Rep: Reputation: 16
Exclamation Don't get ahead of yourself.

globalpiece,

Before trying to use the local MTA to re-dirct mail and causing additional load on the server (depending on the volume of mail being generated), have you looked at the mailer form that is sending the mail? If it is home grown, you should be able to edit it to use the new mail server (ex: mail.mydomain.com). If it is a mailing form built into a CMS etc, you should be able to either change the outgoing mail server through the administrative panel or via a configuration file.

Can you provide us with some more information about the mailer form?

Thanks,
~Art
 
Old 11-24-2008, 03:47 PM   #6
aenright
Member
 
Registered: May 2005
Location: San Antonio, TX
Distribution: CentOS/Fedora/RHEL/FreeBSD/HPUX/Solaris
Posts: 46

Rep: Reputation: 16
Talking Maybe I was getting ahead of myself...

Also, are you using the local MTA on the Linux server for any mail at this point (like in a split domain configuration w/ managed exchange?) If so, then djsoundfx's posts are more pertenant, if not then I would look into your web-app configuration...

~Art
 
Old 11-24-2008, 04:50 PM   #7
globalpiece
LQ Newbie
 
Registered: Nov 2008
Posts: 4

Original Poster
Rep: Reputation: 0
the form data on the contact page (christopherlacass.com/contact.html) is sent to a php script i wrote using php's mail() function. it sends an email to info@christopherlacass.com.

this used to work fine until i started using an Exchange hosting company for my email. at that point i changed my MX records to point to the exchange server. if i send an email to info@christopherlacass.com from my gmail account it get through to the exchange server and i get the message when i check the info email account.

however, since i started using exchange the messages from the contact page on my webserver are not getting through to the EXTERNAL exchange server.

i am a newbie on LINUX but my assumption is that the sendmail still thinks it is supposed to handle email - so when it sees an email addressed to the local domain it trys to handle it locally. and so the message never makes it out to my exchange server.

so i am sure that it is not a problem with the hmtl form or the php script since everything worked fine until i started using an external mail server.

i hope these details help...
 
Old 11-24-2008, 04:58 PM   #8
aenright
Member
 
Registered: May 2005
Location: San Antonio, TX
Distribution: CentOS/Fedora/RHEL/FreeBSD/HPUX/Solaris
Posts: 46

Rep: Reputation: 16
Lightbulb Sendmail is keeping your messages.

globalpiece,

It sounds like sendmail thinks it is still responsible for mail for the domain. In your /etc/mail/sendmail.mc file, you need to change the line that reads:

Code:
LOCAL_DOMAIN(`mail.mydomain.com')dnl
to something else. Alternatively, if you aren't doing anything mail wise with sendmail on the server, you can stop the service, forcing the php mail() function to send the mail to the exchange server.

I hope this helps,
~Art
 
Old 11-24-2008, 06:11 PM   #9
globalpiece
LQ Newbie
 
Registered: Nov 2008
Posts: 4

Original Poster
Rep: Reputation: 0
thanks for your suggestions, but neither of those options worked for me.
 
Old 11-25-2008, 09:47 AM   #10
aenright
Member
 
Registered: May 2005
Location: San Antonio, TX
Distribution: CentOS/Fedora/RHEL/FreeBSD/HPUX/Solaris
Posts: 46

Rep: Reputation: 16
Question

globalpiece,

Did you try shutting down sendmail? Did you verify that no MTA was running on the server? You can do so by running this command:

Code:
netstat -natpl |grep LISTEN
as the root user. Look for anything listening on port 25. Alterntaively, you can check with telnet with this command:

Code:
telnet localhost 25
If it connects, then something is still listening on port 25 and accepting mail. You can also try to change the mailer script to email the form to <user@mx1.mydomain.com> where mx1.mydomain.com is the fully qualified domain name of the hosted exchange server.

Hope this helps,
~Art
 
  


Reply


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
Perl/Web (www) server needs to use mail server for sending forms. dskv Linux - Server 4 04-08-2008 12:34 PM
Web email server from private email server guy_ripper Linux - Server 2 01-17-2008 06:58 AM
spamassassin (directing email). stomach Linux - Software 5 02-17-2006 05:59 AM
directing to different web page using htaccess? Homer Glemkin Linux - Software 0 01-03-2005 08:04 AM
setting up password protected web forms on an apache web server AZDAVE Linux - Security 3 07-07-2004 12:03 PM

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

All times are GMT -5. The time now is 02:03 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration