Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sendmail Configuration - Domain Name

Status
Not open for further replies.

EEYooper

Technical User
Jan 18, 2005
11
US
FYI: I am a Sendmail NewB. I have tried many configurations, but nothing seems to work. I believe I simply need to change my Sendmail domain name, but no matter what I do, the system identity does not change. Here's my problem..

Our ISP hosts our website on a web server as MYDOMAIN.COM. Our email is on a MX mail server as MAIL.MYDOMAIN.COM.

The ISP has sendmail on the web server. I created a simple PHP script to send an email from the webserver to me at ME@MYDOMAIN.COM.

Since the sendmail domain name is set to MYDOMAIN.COM, any email generated by the webserver is considered "local". The email gets stored locally on the web server rather than being allowed to pass to our MX server on the Internet. If I address mail to ME@YAHOO.COM, the messages are sent from the webserver without any problem.

I only wish to SEND mail from the web server. I DO NOT want to receive mail via sendmail or cause any conflicts with the MX server.

So, I need some configuration help. I have R/W permissions on many web server folders but not all. I believe I need to permantly change the $w, $j, $m and $k variables, but am not sure. I have messed with this for nearly a week. There's so much info on the Internet concerning sendmail, but I am getting no where fast.
 
You have me very, very confused. There is no relationship between a web server and a mail server. They can be on the same machine and still not know or care about each other. Here is a quick overview of how they work. Let's say your domain name is JOEBLOW.COM. This name has one purpose in life and that is to point to an ip address. This is handled with domain name servers or dns. Now let's say you have a web server and the ip address is 444.333.22.1. When you want people to visit your site, you give them the name not the ip address. When they type the name into their browser, http:// is prepended to the name. When dns sends you to 444.333.22.1, it comes using the http protocol on the standard http port which is port 80. Now the server listening for that address on that port will answer. In this case it will be the web server. Mail works the same way. First, you creat a name for the server. In dns terms you are assigning an address to a name so it is called an "A" record. So now you have created MAIL.JOEBLOW.COM and point it to 444.333.22.1. Next you creat a mail exchange record (MX). All this does is tell dns that mail.joeblow.com handles the mail for joeblow.com. Now when people want to send you mail, they type your email address in the TO: field of their mail client. This is the same as typing the url in the address bar of a browser but this time it will use the smtp protocol on port 25. Once again, dns sends the request to 444.333.22.1 and the server listening at that address on port 25 will answer the request. If mail is for joe@joeblow.com and it is a valid user on the system, then it will be stored on the server in a single file. All mail for joe@joeblow.com is put into one file. On most linux systems this would be /var/spool/mail/joe. Now let's say you want to get your mail. Your mail client is configured with the server name, user name and authentication so when you open your client, it will get your mail automatically. This is done by going to your mail server using the pop3 protocol on port 110 and if authentication passes the file is tranfered to your client by the pop3 server. Your client will take the file and format it so it can be broken down into individual emails. Your script sends mail out by accessing the MTA (sendmail) directly. It uses the command line rather than the standart smtp port. This is why php or cgi scripts need to know where sendmail is. If you host your own website or for whatever reason don't have a local version of sendmail running, you need to use the smtp method. This usually requires providing the script with your isp email account info. It could be that you are talking about webmail which is a bit different from what I explained but if you can clear things up for me a bit, I might be able to help.
 
Thanks for the response..

Our ISP recently assigned us to a new web server with PHP, MySQL, etc. In your explanation, JOEBLOW.COM and MAIL.JOEBLOW.COM point (ping?) to the same IP address. In my case, they are different.

Using the sendmail SMTP object in PHP, I am able to send email to ME@MYDOMAIN.COM. It reaches MAIL.MYDOMAIN.COM rather than going locally to /usr/mail/<user>, but this method is very slow (nearly a minute to process).

For test/verification purposes, I only have 2 email accounts setup in sendmail on the webserver. I can run PHP scripts that send email to those accounts (the messages reside locally of course). If I change the "send to" address to another valid address that I use daily, but for which there is no sendmail account, a "unknown recipient" error message is sent to the postmaster (again locally on the webserver).

Of course the ISP has told me they do not help with sendmail configurations, but suggested that I change the sendmail domain to MAIL.MYDOMAIN.COM. I believe they may be referring to MASQUERADING, but being a newb...
 
Call me stupid on a stick but I'm still confused. You are saying things like:

2 email accounts setup in sendmail on the webserver.

Do you mean that sendmail and apache (most popular web server) are on the same machine? I this case, mail for local domains would correctly be stored on the local machine. The reason for that is because mail for a domain is stored on the domain's server. There are a lot of ways to get mail to be routed but I need to understand what is is you want to do before I can tell you how to do it. Do you simply want mail for your domain to be handled by another server? Sorry for being so clueless but for the life of me I just can't get it into my head what you are trying to do.



 
That is correct..."In my case, they (web and mail servers) are different."

Yes, sendmail is on the web server, MYDOMAIN.COM.

I have no idea what mail system our ISP uses for MAIL.MYDOMAIN.COM. I do not have access to that server.

Yes, mail originating from PHP pages on MYDOMAIN.COM is being held hostage locally on the MYDOMAIN.com web server. The only mail this server handles is generated by my PHP pages. The sendmail/web server does not/should not accept inbound mail.

I cannot get sendmail configured properly to route, forward, punt, pass or kick those messages, from my PHP pages, to our "real" email server, MAIL.MYDOMAIN.COM (unless I use an SMTP object as stated above).

"Do you simply want mail for your domain to be handled by another server?" - Our email IS already being handled by another server - MAIL.MYDOMAIN.COM. I simply need a way to get mail originating from MY website/sendmail, to be routed to MAIL.MYDOMAIN.COM (which handles mail originating from everywhere else on the Internet).

In fact, I wouldn't even need to forward the mail from the web/sendmail server to the mail server if I could access the web/sendmail email account with MS Outlook. The web/sendmail server responded to the POP and SMTP settings that I used, but for some reason, the server rejected the username/password even though I use the same to logon. The ISP is no help in this area either.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top