Jump to content

[Q] where is mailer in this code?


amkaos

Recommended Posts

Hi:

 

i ve been looking at other ppl's success @ pulling info from sql database then emailing ..

 

i see this old thread.

http://forums.phpfreaks.com/topic/51205-solved-email-all-addresses-in-a-mysql-table/?hl=%2Bphpmailer+%2Btutorial

 

i am not seeing the actual mailer... ex.) mail.domain.com .. etc..

why does this work?

 

it does seem that phpmailer can work for this also?

 

i am verry new to this and appreciate the patience..

 

thanx

Link to comment
Share on other sites

sorry ,, this is code.. i think

include("config.php");
mysql_connect($db_host, $db_user, $db_pwd);
mysql_select_db($db_name);
if (!$_POST) {
  include("form.php");
} else {
$formbody = $_POST['formbody'];

$sql = "SELECT $db_usernamefield, $db_emailfield FROM $db_table";
$result = mysql_query($sql);

while($row = mysql_fetch_array($result)){
$username = $row['username'];
$email = $row['email'];

$body = "$formbody";
$body = str_replace("[username]", $username, $body);
if(mail ($email, $emailsubject, $body, "From: $fromname <$fromemail>"))
echo "Messages sent";
}
}

?>

Edited by amkaos
Link to comment
Share on other sites

if(mail ($email, $emailsubject, $body, "From: $fromname <$fromemail>"))
is the line that sends the mail.

 

"mailer" doesn't mean anything.

hello jessica..

i once saw a tut that you authored using phpmailer.. i looked again but didnt find it..

 

i want to make a form list names and emails from a mysql database.. then sending them emals..

do you talk about using phpmailer for this?

 

thanx for your reply in this thread..

 

i didnt understand that 'mail' is its own functtion..i

was looking for 'mail.domain.com'

 

i still dont know what would be shown to recipient about where the email came from...

 

thanx

Edited by amkaos
Link to comment
Share on other sites

i still dont know what would be shown to recipient about where the email came from...

What the user sees as who the message is from comes from the From: header, which you can see being set in the sample code.

if(mail ($email, $emailsubject, $body, "From: $fromname <$fromemail>"))
                                     //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  Right there.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.