0

I'm trying to send off a bulk email.. all BCC's.. ive tried everything i could find on google.. nothing seems to be working... ive checked my php.ini file as well and set it according to what i found on google...

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25

I get the error in my title and a portion of my php file is below... any help would be much appreciated..

$to = "";
$header = "From:me@gmail.com\r\n";

//Compiling BCC list
for($i=0; $i<$count; $i++)
{
    if($i == 0)
        $header .= $emailContacts[$i];
    else
        $header .= ",".$emailContacts[$i];
}

if(mail($to, $subject, $message, $header))
    echo "MAIL pass";
else
    echo "MAIL fail";

The error:

Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port"

Sirko
  • 72,589
  • 19
  • 149
  • 183
user1703514
  • 1,119
  • 2
  • 7
  • 7

1 Answers1

1

You need to either install an SMTP server on your computer, or use an external SMTP server. You could use Gmail, but they are fairly limited, I recommend using a service that specializes in this domain, such as Sendgrid, Mailjet or Postmarkapp

As a great side benefit, these guys will make sure that you get maximum deliverability (don't end up in spam)

Disclaimer: I work for Mailjet

jfoucher
  • 2,251
  • 2
  • 21
  • 29