a class which will fetch all the email address and send mail

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
niloy.cit
Forum Newbie
Posts: 2
Joined: Thu Dec 31, 2009 4:32 am

a class which will fetch all the email address and send mail

Post by niloy.cit »

db acess details:

host: localhost
username: root
password: <empty>

db name: test

id, username, password, email, create_date, status

I want you to write a class which will fetch all the email address and send an email to all of them with the following:


Subject: Hello there
Message: Hello, dare devil is knocking at your door.

i want to use smtp for sending mail in leau of using php mail().

how i can do it ..?? i will be greatly helpful if i get this class ...
User avatar
JNettles
Forum Contributor
Posts: 228
Joined: Mon Oct 05, 2009 4:09 pm

Re: a class which will fetch all the email address and send mail

Post by JNettles »

You could try to do it yourself and I'm sure someone would be more than happy to help you if you get stuck on something.
niloy.cit
Forum Newbie
Posts: 2
Joined: Thu Dec 31, 2009 4:32 am

Re: a class which will fetch all the email address and send mail

Post by niloy.cit »

Sending Mail from PHP Using SMTP Authentication - Example

<?php
require_once "Mail.php";

$from = "Sandra Sender <sender@example.com>";
$to = "Ramona Recipient <recipient@example.com>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";

$host = "mail.example.com";
$username = "smtp_username";
$password = "smtp_password";

$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));

$mail = $smtp->send($to, $headers, $body);

if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
?>


I CAN DO UPTO THIS NOW PLZ MODIFY IT AND IN A WAY WHERE I WOULD ALSO BE ABLE TO FETCH ALL THE EMAIL ADDRESS FROM SERVER AND SEND MAIL TOO EVERYBODY...
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

Re: a class which will fetch all the email address and send mail

Post by daedalus__ »

please punch yourself in the face. what do you mean "FETCH ALL THE EMAIL ADDRESS FROM SERVER"?
Post Reply