Jump to content

mass email


Foser

Recommended Posts

You could try something like

 

error_reporting(E_ALL);
//database 
$sql = "SELECT * FROM generalContact";
$result = mysql_query("$sql");

while($row = mysql_fetch_array($result))
{
$email = $row['email'];
$subject = $row['subject'];
$name = $row['firstName'];
}

while(!empty($email)
{
//Mail
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'To: '.$name.' <'.$email.'>,' . "\r\n"; //This is the TO name and Email
$headers .= 'From:your email address' . "\r\n"; // This is YOUR name and email

$result = mail($email, $subject, $message, $headers);
}
if($result)
{
echo "Mail has been sent";
}
else
{
echo "Mail Failed";
}

Link to comment
https://forums.phpfreaks.com/topic/87033-mass-email/#findComment-445073
Share on other sites

Sending a large number of e-mails with the php mail() function is grossly ineffecient, it's a) slow, and b) a resource hog, not to mention you'll probably run into your script's reaching their memory limit or max execution time.

 

You should look into Pear Mail....

Link to comment
https://forums.phpfreaks.com/topic/87033-mass-email/#findComment-445089
Share on other sites

Sending a large number of e-mails with the php mail() function is grossly ineffecient, it's a) slow, and b) a resource hog, not to mention you'll probably run into your script's reaching their memory limit or max execution time.

 

You should look into Pear Mail....

 

would you have any good tutorials which explains PEAR mail?

Link to comment
https://forums.phpfreaks.com/topic/87033-mass-email/#findComment-445102
Share on other sites

Its not just windowsboxes you might run into problems sending the mail. Most, ( ~all here in finland) ISP:s block the gate 25 which is used for SMTP protocol for sending mail. But the ISP:s often provide an smtp relay host that you can send your emails through. You just need to find out the hosts address and configure your mailserver to go through that. For example, I had quite an hassle with my ubuntubox with sendmail...

Link to comment
https://forums.phpfreaks.com/topic/87033-mass-email/#findComment-445999
Share on other sites

I've just built my first real site. I finally decided on a hosting service in part because I found they provided a couple of tools to accomplish just this. My ISP doesn't provide anything but a connection and a small amount of space for my personal pages. If your hosting provider offers something like "Fantastico" you should be able to find a mass emailer. Look for "PHPlist" or something like the Perl mailer that has already been mentioned.

Link to comment
https://forums.phpfreaks.com/topic/87033-mass-email/#findComment-446010
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.