Valhalla Legends Forums Archive | Web Development | Needing an email script

AuthorMessageTime
warz
Does anyone know of any scripts out there that can send mass email messages from your website? I'm not sure if PHP can do this, or not. What I'm going to be doing is allowing users to sign up for certain "groups" and allow members of this group to 'blast' emails to everyone in the group. I'm not sure if anyone is signed up for Yahoo!'s group messages, or whatever, but it'll be similar. It's kind of like a forum via email - sort of.

Anywho, I just need to be able to send emails (preferably able to send to multiple recipients at once). PHP preferred.
June 15, 2006, 3:16 PM
Ender
PHP can do this very easily with the mail() function. And it can send mail to multiple recipients at once.

EDIT:

Getting a script for it is pointless. Just do it yourself. It's only a few lines of code.

e.g.:
[code]
<?php
function tryEmail($from, $to, $subject, $body)
{
if (empty($from) || empty($body) || empty($to) || empty($subject))
    ...
$headers = "From: $from" . "\r\n" ."Reply-To: $from" . "\r\n" . 'X-Mailer: PHP/' . phpversion();
$ok = mail($to, $subject, $body, $headers)
        if (!$ok) {
            ...
        }
}
?>
[/code]

If you want to send it to multiple recipients at once, then you can make the $to string "user1@hosting, @user2@hosting" etc.


June 15, 2006, 5:52 PM
warz
Ah, I did not know it was this easy.
June 15, 2006, 6:35 PM
Grok
[quote author=Ender link=topic=15182.msg154458#msg154458 date=1150393945]
Getting a script for it is pointless. Just do it yourself. It's only a few lines of code.
[/quote]

Encapsulation and reuse are both good reasons to wrap things up in a class or module.  Even if a module does very little, hiding the implementation details frees the programmers from having to know even those.
June 16, 2006, 1:28 AM

Search