Re: new guy with stupid question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Lonny wrote:

OK, sorry for the long winded info.
For today I will ask for a script that will gather emails from the email
field of a table in a database and send a news letter to those emails.
How do I compose the email formatted with html for a professional look and
send it to everyone in the database.

If I haven't got myself kicked of this list yet, here is another basic
question.

I want users to be able to select a date for their schedule.
I do not want them to have to follow the format of yyyy-mm-dd
I just want them to select a month from a pulldown, then a day, and then a
year. (I have all this set up all ready)
What is confusing me is the part where I need to think out of the box a bit
and combine there three selection into a date field.
Like $month + $day + $year
INSERT $month$day$year into $date; and come up with something that looks
like 2006-08-13
I hope you know what I am trying to do here.

Have I made any friends yet?
Lonny

Lonny:

Don't slag yourself off so much. That's what this list is for ;o)

First question...

$subject="Email subject line";
$body="<html>Newsletter content</html>";
$return_address="From: email@xxxxxxxxxxxxxxxxx";

$query="SELECT $email_address FROM some_table";
$result=mysql_query($query) or die("Something went wrong, sweetheart: " . mysql_error());
while($row=mysql_fetch_array($result)){
   extract($row);
   mail($email,$subject,$body,$return_address);
}
Untested, but should work. And I know some of the people on the list will say that the mysql_fetch_array() is not the best approach - but you can fiddle with mysql_fetch_row() if you'd prefer. It would probably be a bit more efficient.

As to HTML content for your newsletter, I would test first. Create a newsletter, send it to yourself and, if possible a couple of other people. Try various layouts until it looks right. But bear in mind that different e-mail clients are not consistent with the display of html content. So try as many different clients as you can, especially Outlook, Lotus Notes (if there are a lot of busness users), Thunderbird, Gmail, hotmail, etc.

For what it's worth, I do a popular and highly regarded newsletter entirely in ASCII text. Of the over 2000 subscribers, only one person every complained about the appearance - and his complaints were such that it was clear he wasn't remotely interested in the actual content of the newsletter.

For the last question, get the date info from your drop down menus, then in php...

$date_for_db=$year."-".$month."-".$day;

...and insert $date_for_db into your table.

Good luck,

Jeffrey

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux