homepage Welcome to WebmasterWorld Guest from 54.242.126.126
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
mail() not working for all email accounts
Email not received at hotmail account
pathak

10+ Year Member



 
Msg#: 3369626 posted 6:31 pm on Jun 16, 2007 (gmt 0)

Hi,

I am using mail() function on Apache server.

My header entries are as follows:

$rheader = 'MIME-Version: 1.0' . "\r\n";
$rheader .= 'To: ' . $toemail . "\r\n";
$rheader .= 'From: Info <info@example.org>' . "\r\n";
$rheader .= 'Reply-To: Info <info@example.org>' . "\r\n";
$rheader .= 'Return-Path: info@example.org' . "\r\n";

The function is working well. I am receiving mails to my account. But for some email accounts specifically HOTMAIL I am not able to send mails. It is not even coming to its Junk folder. What could be the problem? Do I have to add some more entry to the header?

In the received mails the header entry are:
X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.7
Received: from nobody by host.vps92.sgvps.net with local (Exim 4.63)
(envelope-from <nobody@host.example2.net>)
id 1HzZ09-0007ua-E3; Sat, 16 Jun 2007 10:11:41 -0400

Is this NOBODY in "Received: from" a problem? Please guide me what should do?

Thanks in advance.

[edited by: eelixduppy at 12:52 am (utc) on June 18, 2007]
[edit reason] example.com [/edit]

 

barns101

5+ Year Member



 
Msg#: 3369626 posted 8:22 pm on Jun 17, 2007 (gmt 0)

There are many threads on WebmasterWorld about non receipt of emails to Hotmail addresses.

You need to find out if your server's IP address is blacklisted. And then you need to find out if your server has valid PTR records. The latter two points all contribute to hotmail (and others) determining if your email is spam.

ahmedtheking

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3369626 posted 8:29 pm on Jun 17, 2007 (gmt 0)

As well as the suggest above, you've got to look at your content. Don't forget to always add a "From: my company <no-replay@mycompanyssite.com>". Make sure that your MX records and server IPs are not blacklisted, even graylisted! Also, make sure that SNMP (that's the function that mail uses to send mail, on *nix and BSD it is) is running under the correct user so you don't get NOBODY var anymore (it should be yourserver.yourisp.com)

pathak

10+ Year Member



 
Msg#: 3369626 posted 5:36 am on Jun 18, 2007 (gmt 0)

Thanks for your suggestions.

Ahmedtheking could you please tell me how can I configure SMTP to apache server. I have following lines in php.ini at present:

[mail function]
; For Win32 only.
;SMTP = localhost ;
smtp_port = 25

; For Win32 only.
sendmail_from = info@companyname.org ;

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = /usr/sbin/sendmail -t ;

Best

ahmedtheking

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3369626 posted 7:18 am on Jun 18, 2007 (gmt 0)

Now I need a few details from you: Is your machine windows or BSD or *nix based?

vincevincevince

WebmasterWorld Senior Member vincevincevince us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3369626 posted 8:59 am on Jun 18, 2007 (gmt 0)

That, I believe, is part of your SENDMAIL configuration or your server name configuration. I don't think you can override that by PHP.

pathak

10+ Year Member



 
Msg#: 3369626 posted 9:15 am on Jun 18, 2007 (gmt 0)

We have linux server.

ahmedtheking

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3369626 posted 1:02 pm on Jun 18, 2007 (gmt 0)

No it can't be overwritten by PHP, that's why we need to adjust your SNMP settings. Now SNMP is the protocol that sendmail should use in order to send its emails. Because you're not using an SMTP server, you run the risk of looking like junk mail.

You need to look at the users and groups for your server. For example, within the group (say) www would be Apache, PHP, etc... Now, when it comes to sendmail, it should be running as the logged in user, ie 'webserver' (not to be mistaken with www). A reason why you're getting NOBODY@YOURDOMAIN is that sendmail may not have the proper permissions to give itself a name or may not belong to the right group.

So what's the best way? Instead of tinkering and wasting time and maybe causing more problems, I'd suggest you reinstall the whole web server (not the OS) through RPM [rpm.org...] With RPM, you can install and uninstall things nice and easy and add filters. This makes everything a lot less messy.

I, being on a BSD based system, use DarwinPorts and RPM is pretty much the same. Where I would install a web server on DarwinPorts like so:

sudo port install php5 +apache2 +snmp +pcre +mysql5 (You can see how you can add items that can link into the installation with +)

RPM works the same: [rpm.org...]

Now you may be thinking "What?". But trust me. Instead of us going back and forth finding the route of your problem here, it's better to just reinstall it and in a more 'sustainable' way (such as Darwinports and RPM).

milanmk

5+ Year Member



 
Msg#: 3369626 posted 2:27 pm on Jun 18, 2007 (gmt 0)

Pass the -f parameter to sendmail when sending mails.

mail('info@example.com', 'subject', 'message', null, '-f info@example.com');

If your Exim config is fine then this should work.

Milan

mattclayb

5+ Year Member



 
Msg#: 3369626 posted 8:51 pm on Jun 19, 2007 (gmt 0)

Your webhost may restrict outgoing email sent to domains through the local mail function other than those on the root server. This can be quite common in an effort to prevent SPAM.

If this is the case, it is unlikely the host will remove this restriction but you can always ask ;-).

Otherwise you can either, get a new webhost that will allow sending of mail from script to other domains, or you can just place the mail script on another server and call it through the cURL function on your website.

You can also use cURL to connect to an smtp server on a Linux server. You will need an smtp relay that allows incoming connections via web - one that does allow this is Gradwell.

If you are scripting to send to external domains through variables, you must ensure your script is secure - it would be a Spambots dream to find it.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved