0

I'm pretty burnt on trying to figure this one out. The main problem is that when i use a loop with php mailer to blast email our users, it only gets to some, and I believe this to be a DNS issue.

Here is the mail code

function massEmail($from,$subject,$to,$body) {
    require_once('packages/class.phpmailer.php');
    $success = 0;
    foreach($to as $person) {
        usleep(2000);
        $mail = new PHPMailer(); 
        $mail->From = $from;
        $mail->IsHTML(true);
        $mail->FromName = "cmiVFX";
        $mail->Subject = $subject; 
        $mail->Body = $body;
        $mail->AddAddress($person);
        $ret = $mail->Send();
        if($ret) {
            $success++;
        }
    }   
    var_dump($success);
}

When running hostname I get this

server.cmivfx.com

When running hostname -f or --fqdn i get

hostname: Name or service not known

when restarting sendmail i get

hostname: Name or service not known

Here is my hosts file

127.0.0.1 localhost.localdomain localhost
127.0.1.1 server.cmivfx.com cmivfx.com
69.162.76.226 server.cmivfx.com cmivfx.com

my hostname file is

server.cmivfx.com

My mail servers point to google apps so dig cmivfx.com any gives me

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11895
;; flags: qr rd ra; QUERY: 1, ANSWER: 9, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;cmivfx.com.            IN  ANY

;; ANSWER SECTION:
cmivfx.com.     1553    IN  SOA ns1.limestonenetworks.com. noc.limestonenetworks.com. 1344528611 16384 2048 1048576 2560
cmivfx.com.     1553    IN  NS  ns1.limestonenetworks.com.
cmivfx.com.     1553    IN  NS  ns2.limestonenetworks.com.
cmivfx.com.     1544    IN  MX  1 ASPMX.L.GOOGLE.com.
cmivfx.com.     1544    IN  MX  5 ALT1.ASPMX.L.GOOGLE.com.
cmivfx.com.     1544    IN  MX  10 ASPMX2.GOOGLEMAIL.com.
cmivfx.com.     1544    IN  MX  10 ASPMX3.GOOGLEMAIL.com.
cmivfx.com.     1544    IN  MX  5 ALT2.ASPMX.L.GOOGLE.com.
cmivfx.com.     1519    IN  A   69.162.76.226

;; Query time: 0 msec
;; SERVER: 208.115.254.242#53(208.115.254.242)
;; WHEN: Thu Aug  9 11:48:14 2012
;; MSG SIZE  rcvd: 268

And finally, when i run the mail php code with my gmail its fine. With some others I get

Could not instantiate mail function

Hopefully I've provided enough information that someone who knows about sendmail can help me out. Thanks so much!

Sean Clark
  • 1,436
  • 1
  • 17
  • 31
  • 2
    php's mail() is not reliable, and provides zero in the way of useful diagnostics. Use swiftmailer or phpmailer instead - far better error messages. and check your mail server's log to see what happens to the mails after php hands it over (remember, php doesn't actually deliver the mail, it just drops the envelope into the mail box). – Marc B Aug 09 '12 at 16:55
  • Hmm, I am using phpmailer, That was the first block of code I provided. Are you seeing somewhere that I'm not? – Sean Clark Aug 09 '12 at 17:24
  • Sorry, my bad... too much sugar at work today. – Marc B Aug 09 '12 at 17:45

1 Answers1

2

There's conflict between /etc/hosts and /etc/hostname: change /etc/hostname as: cmivfx.com

If there's special reason you need remain hostname as server.cmivfx.com, you may use /etc/hostname + /etc/resolv.conf let 'hostname -f' to get the right FQDN.

You may get some background information here: configure FQDN on multiple domains supports mail server

Franklin
  • 29
  • 6