LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 02-28-2006, 06:43 AM   #1
juancha
LQ Newbie
 
Registered: Feb 2006
Posts: 17

Rep: Reputation: 0
Configuring my mail server


Hi

I posted on here previously with regards the fact I had written a php script to send an email. The email never arrives to my inbox.

This what I found in the mail log


tms1:/var/spool/exim4/msglog# cat *

2006-02-21 18:47:54 Received from www-data@ U=www-data P=local S=438

2006-02-21 18:47:56 juan_chandler@hotmail.com R=dnslookup T=remote_smtp: SMTP error from remote mailer after MAIL FROM:<www-data@> SIZE=1471: host mx3.hotmail.com [65.54.244.72]: 501 Invalid Address

Process failed (1) when writing error message to www-data@ (frozen)tms1:/var/spool/exim4/msglog#

After posting to another forum someone else mentioned that this happens because the mail server isn't configured correctly.

ie. 501 invalid address as the mail server isn't adding the from address to the domain.

Can someone advise me on how I go about re configuring the mail server.

here's the php code to send the email too.

Code:
<?php

$mail_to="juan_chandler@hotmail.com";
$mail_from="juan@go-torevieja.com";
$mail_sub="Emailing with php";
$mail_mesg="This is a test to see if I am able to email using php";

//Check for success/failure of delivery 
if(mail($mail_to,$mail_sub,$mail_mesg,"From:$mail_from")){
echo "E-mail has been sent successfully to $mail_to";
}
else{
echo "Failed to send the E-mail from $mail_sub to $mail_to";
}
?>
 
Old 02-28-2006, 08:06 AM   #2
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
Are you using sendmail? Where does the "www-data@" come from? Is "www-data" the name of the user under which Apache (or PhP) is running when it sends the mail out?

Let's make one thing clear: the From: address you wrote in your PhP script goes into the mail header as the from address, but it's not the actual sender address that the remote mail server (in this case, hotmail's mx3 machine) takes into account. This address, called the envelope address, is different from your from: address.
This is shown by looking at the FROM:<...> part of the error message, which is the sender address, as seen by hotmail's mail server.

So, the point is, that you don't want to change your From: address. It's probably just find. It's the envelope address that seems to be wrong. It contains "www-data@", which is clearly an invalid mail address, hence the error you're seeing.

Normally, those envelope sender addresses get written automatically by your mail system and they contain your_user@your_computer.your_domain where your_computer is sometimes omitted.
So, my guess is that you're running PhP under the user "www-data", either via a webserver (Apache) or
directly. But your system didn't add your domain. So you may need to check some hostname configuration issues.

If I'm not mistaken, I've seen a similar issue on this forum for someone who didn't have the right entries in /etc/hosts.
So, could you please post the contents of:
/etc/hosts
/etc/host.conf
and the result of the hostname or uname -a commands?

As for the configuration of your mail server. Well, it could be that the mail server was wrongly configured to not add your domain at the end of the envelope address, which is not the default behaviour.
What mail server are you using?

Could you also please post your php.ini settings that are related to mails and SMTP, please?
 
  


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
Configuring SEnd mail as Email server in Redhat Linux 8.0 ganeshrk Linux - Networking 0 01-31-2004 05:02 AM
Configuring web and mail server...HELP! Markv Linux - Newbie 9 01-11-2004 06:37 PM
configuring a mail server behind a firewall aaelano Linux - Software 1 09-23-2003 11:19 AM
configuring mail server (postfix+fetchmail+procmail) amolchikhale Linux - Networking 0 08-01-2003 05:59 AM
configuring mail server on linux netpraveen Linux - Networking 1 02-21-2002 11:39 PM


All times are GMT -5. The time now is 10:18 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration