views:

73

answers:

2

I'm having trouble when sending emails thorough the mail() function.

I have a script that works perfectly fine for an email address like [email protected] but when the first part of the email is something with a dot like [email protected] it doesn't work and returns this error :

Warning: mail() [function.mail ]: SMTP server response: 554 : Recipient address rejected: Relay access denied in confirmed.php on line 119

I am using real email address but have changed it in the above example.

Any thoughts - I'm not a php master but surely there is an easy way to send emails to address with a 2 part first section??

Thanks in advance Ali

+2  A: 

It is not PHP's fault. It is your SMTP-server. Check mail log i.e. /var/log/mail.log and see if it puts out anything. My best guess is that your relaying is missconfigured.

DeeD
+1  A: 

If the code below fails with this error, then DeeD is partially correct - but it's not relaying which is broken - the address re-writing rules are completely ^&*(ed up.

<php 
 mail('[email protected]','hello','test');
?>

Also try:

However this would be a phenomonally stupid error on the part of the person who set up the MTA. I susepct its much more likely that code elsewhere may be modifying the address before the call to mail(...) or that your analysis is incomplete. If this is the case, then neither of the tests above will return the original error - instrument your code to find out where the address is being changed.

Alternatively, if the MTA really doesn't like a . in the name - go buy a cattle prod for the person who configured it.

C.

symcbean