• Welcome to Valhalla Legends Archive.
 

Needing an email script

Started by warz, June 15, 2006, 10:16 AM

Previous topic - Next topic

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.

Ender

#1
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.:

<?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) {
             ...
        }
}
?>



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



warz

Ah, I did not know it was this easy.

Grok

Quote from: Ender on June 15, 2006, 12:52 PM
Getting a script for it is pointless. Just do it yourself. It's only a few lines of code.

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.