Page 1 of 1

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

Posted: Thu Dec 31, 2009 4:38 am
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 ...

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

Posted: Thu Dec 31, 2009 9:38 am
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.

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

Posted: Thu Dec 31, 2009 12:05 pm
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...

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

Posted: Fri Jan 01, 2010 12:43 am
by daedalus__
please punch yourself in the face. what do you mean "FETCH ALL THE EMAIL ADDRESS FROM SERVER"?