LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-27-2009, 09:12 AM   #1
impelmedia
LQ Newbie
 
Registered: Nov 2009
Posts: 5

Rep: Reputation: 0
Question Problems with PHP mail on new linux server....


Hello!

I have been tearing my hair out all day over this one.... we are currently migrating from a windows web server to a linux box with apache and php 5... however my mail scripts within our websites are causing us big problems! I can send mail to googlemail and yahoo, but if i try to send it to a custom mail server (i.e. our business mailserver) or an email address currently located at our old web server nothing is coming through. I'm not getting any errors when i send the mail though - the response comes back as '1', as in success....well surely no emails coming through means this is a lie?!?!?! I have a feeling it is a server side problem....as the script used to send the mail works for google/yahoo..the code we are using is the following:

Code:
include "/usr/share/php/Mail.php";
       
        $date = date("D, d M Y H:i:s O");
       
        $returnPath = "email@address";

        $from = "email@address";
       
        $to = $_POST['email'];
       
        $subject = "Forgotten Password - New Login Details";
       
        $body = $message;
       
        $host = "localhost";
       
        $username = "username";
       
        $password = "password";
       
       
        $headers = array ('From' => $from,
       
          'To' => $to,
       
          'Subject' => $subject,
         
          'Date' => $date,
       
          'Return-path' => $returnPath);
       
        $smtp = Mail::factory('smtp',
       
          array ('host' => $host,
       
            'auth' => true,
       
            'username' => $username,
       
            'password' => $password));
       
       
       
        $mail = $smtp->send($to, $headers, $body);
Can anyone help?? Obviously we don't want our clients without their mail facilities for very long!

Thanks in advance!
 
Old 11-27-2009, 11:07 AM   #2
Web31337
Member
 
Registered: Sep 2009
Location: Russia
Distribution: Gentoo, LFS
Posts: 399
Blog Entries: 71

Rep: Reputation: 65
have they received mail before you moved?
if you can send it and google,yahoo can get it, perhaps you need to look onto your mail servers.
 
Old 11-30-2009, 03:52 AM   #3
impelmedia
LQ Newbie
 
Registered: Nov 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Smile

Thank you! We will do that...hopefully it is something that simple!
 
Old 11-30-2009, 03:55 AM   #4
jippen
LQ Newbie
 
Registered: Apr 2007
Posts: 7

Rep: Reputation: 0
I do support for a spam filtering company for a living so, believe me, I've seen a lot of this sort of thing happening.

I recommend checking the logs on your mailserver, to see if it rejected the email. If you can't access the logs, or can't find them, run a packet capture, send a test email to yahoo, and one to the work server, and check what the differences are.
 
Old 11-30-2009, 07:19 AM   #5
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
If its your server you could try using a PEAR library. I remember using this library some time ago for the same purpose. Do not have the code at hand but can surely give you a day later.
 
  


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
php: different mail server from php.ini rayds Programming 0 09-14-2004 04:48 AM
Cannot send mail with mail() command in PHP 4.3.4, Apache 2.0.48, Mandrake Linux 10 arcanum Linux - General 3 06-27-2004 07:06 PM
Sending mail with PHP on linux machine through exchange on Windows server 2003 TVScoundrel Linux - Newbie 1 06-18-2004 02:22 PM
Sending mail with PHP on linux machine through exchange on Windows server 2003 TVScoundrel Linux - Networking 2 06-18-2004 01:02 PM
problems with the apache & Php server of mandrake linux 9.1 krotaz Linux - Networking 6 11-21-2003 09:24 PM


All times are GMT -5. The time now is 06:50 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