php outgoing mailing list SMTP help
Posted: Thu Apr 09, 2009 6:52 pm
i have made a MYSQL database and linked up a crude php page so that a message can be sent to all on the mailing list.
im having trouble getting a mail host. im new to PHP and so am unsure how to go about this. i have found a website that says i can use googlemail/gmail as a free SMTP server. this is the site: http://www.geekzone.co.nz/tonyhughes/599
this is the section of the code:
<?php
require('connect.php');
//change php.ini smtp line
ini_set("SMTP", "");
//standard mail header
$headers = "From: admin@slumkingtrampart.com";
//get message to send
$message = $_GET['message'];
//loop through
for($x=0;$x<count($_GET);$x++)
{
if ($_GET["mail_$x"])
{
//mail setup
$to = $_GET["mail_$x"];
$subject = "Newsletter";
$body = "Dear ".$_GET["name_$x"]."
\n\n $message \n\n
PHP Academy.";
mail($to, $subject, $body, $headers);
}
}
echo "All mail has been processed.";
?>
i have seen this code work with the Shefeild uni mailhost but obviously i dont have access to this so it dosnt work.
to be honest i dont even know if this gmail thing is what i'm looking for. any help would be great. i'm a bit of a PHP novice so im not sure what im doing.
thanks in advance
Luke.
im having trouble getting a mail host. im new to PHP and so am unsure how to go about this. i have found a website that says i can use googlemail/gmail as a free SMTP server. this is the site: http://www.geekzone.co.nz/tonyhughes/599
this is the section of the code:
<?php
require('connect.php');
//change php.ini smtp line
ini_set("SMTP", "");
//standard mail header
$headers = "From: admin@slumkingtrampart.com";
//get message to send
$message = $_GET['message'];
//loop through
for($x=0;$x<count($_GET);$x++)
{
if ($_GET["mail_$x"])
{
//mail setup
$to = $_GET["mail_$x"];
$subject = "Newsletter";
$body = "Dear ".$_GET["name_$x"]."
\n\n $message \n\n
PHP Academy.";
mail($to, $subject, $body, $headers);
}
}
echo "All mail has been processed.";
?>
i have seen this code work with the Shefeild uni mailhost but obviously i dont have access to this so it dosnt work.
to be honest i dont even know if this gmail thing is what i'm looking for. any help would be great. i'm a bit of a PHP novice so im not sure what im doing.
thanks in advance
Luke.