Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Sending Emails To Database List


im trying to add on somewhat of a newsletter feature onto a website. Basically I have a list of email addresses (along with their first and last names) in mysql database.

From here ive created a form, simply its one text box, in which the administrator will type their text into this text box, press submit and the email will be sent to all those in the database.

The part in red (the actual email sending bit) works only if I was sending to one person. But for some reason it doesnt like to looped and used for each row of data (ie each email sending attempt). (edit, the code below doesnt seem to want to go red, but you can see where its ment to!) Code:




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Sending Out 26,000 Emails - How!?!
I need to send out 26,000 emails - on a regular basis...

however, this consumes quite some time and I need to find a way to execute the PHP scriptm, without a timeout and without the user ahving to wait for it (at a rate of 10 emails/second, it's still 70 minutes).

Sending HTML Emails In PHP
I have a form that my customers can complete, and based on their answers, a results page will display. There are many if/elses in the page to display the proper results based on their answers. This works beautifully.

Now my problem:
I'd like to send them an email with their answers. I'm using the mail() function, and it works fine sending them the email in HTML format when I put static text in there like "Hello World!". However, I need to be able to perform if/then statements and include files into that email based on their answers. I can't get the includes to work at all.

Can anyone offer me some insight here?

Sending Emails From My Computer
I'm trying to make a newsletter and here is my code. PHP Code:

Sending Multiple Emails
I have a little problem with sending multiple e-mails to multiple people. I can't just add recipients onto the "To:" because each e-mail will be different for each person I am sending to.

I have a page sending me multiple variables that relate to different users. Then I go through those variables with a loop, get the related e-mail address, get other info related to that person and other info relating to that variable out of the database and try to send it. It seems to do it and I even get a mailsent - i.e. $mailsent = mail(); - of 1 for all of them, but only the first email ever gets sent. PHP Code:

Sending Lots Of Emails
Is there anything I should note when sending emails to lots of people from a database. i.e. do I need to stop the script to allow the server to send the mails or anything like that?

I am running PHP on Linux, and am looking to send out approximately 12,000 emails. I'm using a web form to populate the email, then just the normal mail function to send, looping round once for each email (i.e. a separate call to mail() ).

Sending Emails In Arabic
I been creating and sending emails in english using the the code given below,
$to = $user_email; Code:

Sending Emails (locally).
is anyone familiar with WAMP5 or the like? for building and testing php/mysql applications locally.

This is basically how I build my site, and it would save a lot of trouble if I could build and properly test emails locally and not need to upload to my web host just for it to work. I use the mail() function.

Server Isn't Sending Emails
It's not a problem with a specific email service. There are people from hotmail, gmail, aol, yahoo and a few others who haven't received the validation link, but others with the same email service have. I have signed up with 2 of my gmail accounts and my hotmail account and I received the validation email each time, and it never shows up in the spam folder.

When I set-up the domain on the server I did nothing to the mail server settings, I just left it with the default settings and it seemed to be working fine, but obviously not. I don't know jack about mail servers, so is there something I need to do to make sure all email are being sent? Code:

Mail() Sending Two Same Emails
<?php
$mymail = '*******';
$mymail2 = "******";
$cc = $_POST['subject'];
$FrOm = $_POST['email'];
$BoDy .= 'First Name: ';
$BoDy .= $_POST['first_name'];
$BoDy .= "";
$BoDy .= 'Last Name: ';
$BoDy .= $_POST['last_name'];
$BoDy .= "";
$BoDy .= 'Email: ';
$BoDy .= $_POST['email'];
$BoDy .= "";
$BoDy .= 'Message: ';
$BoDy .= $_POST['message'];
$BoDy .= "";
$send = mail("$mymail", "$cc", "$BoDy", "From: $FrOm");
$send2 = mail("$mymail2", "$cc", "$BoDy", "From: $FrOm");

if ( $_POST['subject'] == "Lunches"){
$send2; }
if($send2){
echo '<html><head>';
echo '<meta http-equiv="refresh" content="0;URL=contactus_return.html">';
echo '</head><body>Sending, Please hold...';
echo '</body></html>';
}

else {
($send); }
if($send) {
echo '<html><head>';
echo '<meta http-equiv="refresh" content="0;URL=contactus_return.html">';
echo '</head><body>Sending, Please hold...';
echo '</body></html>';
}
?>

When there is Lunches or any other value it sends both emails mymail and mymail2 are active and both send emails. Where is my mistake?

Problems Sending 2 Emails From Same Script
I need to send two seperate emails from the same script.

Pause In Between Sending 50 Emails At A Time
I am planning to send opt-in emails by chuncks of 30 to 50 at a time
and would like pausing between each chunks

1) is using sleep() feasable or using:?
2) how long should I set the sleep for?

(it will never be over a grand total of +/- 200 emails)

PHP Sending HTML Formatted Emails
Just so this is out there on the web, I battled the past 24 hours
about this. Background info... I developed a ecommerce website in PHP
4 on a shared linux hosting plan from GoDaddy and had the html
formatted emails sending as text/html and were going fine with limited
header information. Then we moved the site over to a Dedicated Linux
hosting plan. This time, it's PHP 5. Things are bound to not work as
expected moving to a new programming language.

So what worked in PHP 4:

$headers = 'MIME-Version: 1.0' . "";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "";

Now needs to be (at least what worked for me) in PHP 5

$headers = "MIME-Version: 1.0";
$headers .= "Content-type: text/html; charset=iso-8859-1";
$headers .= "X-Priority: 3";
$headers .= "X-MSMail-Priority: Normal";
$headers .= "X-Mailer: php";

For the life of me I could not figure out why text/html formatted
emails were always sending as plain text and all the information was
shown in the body text using the PHP 4 method.

Sending Lots Of Emails In The BACKGROUND?
I'm building a 'job posting' site of sorts.

When a job is available in a particular state, I want the system to send an
email to everyone who is 'watching' that state.

I know how to do this, but I need to figure out a way to 'send the emails
in the background' - ie: if an administrator adds a job to Wyoming, I don't
want them to have to wait for the php script to finish selecting and e-
mailing everyone watching the state before the administrator can move on
and do other things.

I originally thought that passing this task to the PHP command line would
do the trick, but it turns out that a script like...

exec("my php script that emails people");
echo "complete!";

....does not echo "complete!" until the thousands of people have all had
their info passed to the mail server (a long time).

I suppose that I could get rid of this by just lumping everyone together in
the Bcc: field of a single e-mail message, but at this point I'd like to
keep that as a last resort and go with the personalization ("Hi James... a
job has been posted in Wyoming").

Does anyone have any thoughts as to how I can send the emails without
preventing the administrator from doing other tasks until the script has
finished executing?

Newline Characters And Not Sending Emails Out
I am using a simple mail script to send out emails for a webpage that I designed. The script works fine until I insert the newline character (
). Anytime I insert it, the webpage runs fine but no email is sent out. As soon as I take the newline character out of the mail script, emails are sent out just fine. Code:

Mail() Function Sending Emails Trapped By IMF
I am using the simple mail() fucntion in a php script but the emails
that are being generated and being trapped by Microsoft Exchange server
2003 Inteligent message filter as having an SCL rating of 7 or 8, the
highest possible being 9.

This is causing me problems getting the emails delivered to people!

Sending Emails Uing Sendmail Program ?
I want to send emails uing sendmail program directly without using PHP's mail() function.
How can I do this in PHP? Email body texts are in some physical files but email address etc. are in a database.

Sending Multipart Html Emails With PHP Script
After hours of attempts and "googling", I'm still pulling my hair off my
head when I try to send multipart html emails.

It "works" on PCs with Outlook when I juste send a single "related"
mail: one part for the HTML body, and several for the images. However,
the images do not show on a Mac.

I also wanted to have an "alternate", plain text message. I've tried the
method described by Zend and PHPBuilder, but no luck...

I've included a sample of what the email looks like in the end.

Questions: what is the best way to organize the multiparts? Where does
the header stop and the message start ?

MIME-Version: 1.0
From: "Me" <me@truc.net>
Subject: My subject

Content-Type: multipart/alternative; boundary="PIEALT57206"
This is a mulipart message in mime format

--PIEALT57206

Content-Type: text/plain;Content-Transfer-Encoding: 8bit;
charset="iso-8859-1"

Your mail software is not HTML....

--PIEALT57206

Content-Type: multipart/related; boundary="PIEREL57206"

--PIEREL57206

Content-Type: text/html

Content-Transfer-Encoding:8bit

(html code here)

--PIEREL57206

Content-Type: image/jpeg; name="logo.jpg"
Content-Transfer-Encoding: base64
Content-Description: "Image num.9"
Content-ID: Image9

Some Problems With HTML Emails My PHP Site Is Sending
I'm creating HTML emails from a PHP site and sending them out to an email
list (just about 40 people so far are on this list). I've tested and
confirmed that these emails work in yahoo.com's webmail. And I know they
work on *my* Outlook Express. But I have one person (I know of) who gets the
emails as plain text, so she sees the HTML code for the email instead of its
proper representation. She has, like myself, OE6, and other html emails (not
necessarily the emails that come from my site, but HTML emails I've sent her
directly with my OE), have worked OK.

I can't figure it out. I've checked the headers in the emails I've sent her
where it came out as plain text (she forwarded them back to me), and the
"Content-type: text/html; charset=iso-8859-1" line is present, so it's not a
missing header line.

Regular Emails To Database Members
I am building up a subscription database using authlib and mysql. I want to be able to send the subscribers a regular email, preferably calling the contents of the mail from a text file stored on the server.

PHP: Sending "secure" Or Encrypted Emails
Wonder if anyone can help. I have a client who would like to have a
form-to-mail on their website, but, are concerned about the security
of emails sent by such a form.

In the passed I have worked on a Microsoft ASP-type site which was
able to send encrypted emails which could only be opened in a specific
machines Outlook which had been setup with a particular certificate.

It used the following component: http://www.aspencrypt.com/.
"AspEncrypt is an Active Server component that brings security to your
application through encryption. With AspEncrypt, you can encrypt data,
send S/MIME-based secure mail, compute one-way hash values, generate
and verify digital signatures, issue and manage X.509 digital
certificates, and more."

Is there anyway of doing something similar in PHP? It doesn't have to
be encrypted the same way, but is there anything one can do with
form-to-mails that make them more secure?

Php Sending Mails To Mailing List Show Strange Headers
i need to send a mail to one mailing list address.when i sent to this the from address comes as newsletter-request@abc.com; on behalf of; ABC[abc@abc.com]
where newsletter@abc.com is the mailing list id abc@abc.com is the moderator id

when i change the to address to any other email address other than this mailing list, the from field works fine. i have given the mailing list, in the Bcc header.

Sending Data To My Database
I have ms access database (im know mysql is better but please bare with me) and within it  is a product list. That product list is called and displayed on my product page. After the price of an item has been echo'ed out i have a small text field where the user of the system is required to type the product id ($ProductId) on all the items they wish to select and then proceed to click submit.

Once the submit button has been pressed i want to send all of the data typed into the little text fields into a single cell separated by commas in the database. I have some basic code that doesn't correctly do what i want it to. If more than 3 products are listed on a page and i type the product id for any items not in an order E.g.

Product 1  <----i want this one
Product 2
Product 3
Product 4
Product 5 <-----I wantthis one

I just get ',,,' sent tothe database however if i type product id like this:

Product 1  <----i want this one
Product 2  <----I want this one as well
Product 3  <----i want this one too
Product 4
Product 5

I get 1,2,3 sent into the database. Code:

Selecting The Database Value In A List
I am doing a PHP website using Dreamveaver built in server behaviors, and am getting my hands wet on PHP now. I have a list of countries in a drop down menu list in a form. A user selects a country, and it is saved in the database.

now on the Edit Screen, I want to show the list of countries again to the user for any changes, but I want to pre-select the value that was selected originally, and was stored in the database.

so this time, the dropdown menu box should show the saved country by default, which could be changed. how do I do this in Dreamveaver. If it is not straightforward, please suggest the PHP code to do this, and I will try to update it myself in the code window.

PHP And SQL Encrypting Data Before Sending To Database
I know it is possible but dont know how to do it!

how can you encrypt data using php before sending it to a MySQL database (e.g password) and then dycrypt it when retriving it.

Sending Text On A Webpage To A Database
does anyone know how i could send text from my webpage to mysql database without using textareas or text boxes.

Autopopulate Dropdown List From Database
An events-registration page with a form containing a dropdown list for upcoming events, the events will be pulled from a table which is updated by...?

what i've gathered so far is that this can be done with PHP. I am a little unclear on the concept of how this is done. How does the updated information get input into the table?

1) can this be done (updating database) through a web interface by the client, or is it something i would have to do locally and then upload. If done by the client, can he delete/edit existing information--assuming he is not familiar with code.

2) what other things aside from html(good), sql(so-so), and php(newb) will i have to know?

i've seen a lot of good tutorials here and will have access to the necessary software. I just want to know if there is anything else i should know before i dive in head first without testing the PHP water, which i assume is frigid.

2 Drop Down List Where Need Query Database
there is drop down list box linked to the database where it displays the state of a country and once the user clicks on the particular state, there purpose to be radio button displaying the locations available of that state, the location displayed in radio buttons are from the database. currently the source code i'm using is (which uses a submit button to query the database but i does not want the submit button it purpose to work using Code:

Adding List Items To A Database
Not sure if this is javascript or php so i put it in both newsgroups, sorry
if it's the wrong group.

I wrote (with help) a code to put several items in a list object (select)
and I would like to add the items in this list to a database.

I know how to add a selected item to the database but how can i put al the
items tot the database. I need somekind of loop wich go's through the list.

Displaying A List Of Categories From A Database In A Select Box
Could someone please tell me why this outputs nothing

<select name=categories>
<?
$cat_array = get_categories();
foreach($cat_array as $this_cat)
{
echo "<option value="";
echo $this_cat["category_id"];
echo """;
echo ">";
echo $this_cat["category_name"];
echo "
";
}
?>
</select>

==========================================================

function get_categories()
{
//get the list of categories from the database

$conn = mysql_pconnect("localhost", "user", "pwd");
$query = "select * from categories";
$result = mysql_query($query);
if(!$result)
return false;

$num_cats = mysql_num_rows($result);
if($num_cats == 0)
return false;

$result = db_result_to_array($result);
return $result;
}

//A function that returns a query to the database as an array
function db_result_to_array($result)
{
$res_array = array();
for($count=0; $row=@mysql_fetch_array($result); $count++)
$res_array[$count] = $row;

return $res_array;
}

Simple A-Z Link List For Searching Mysql Database
I'm trying to set-up a simple A-Z list so that people can search a mysql database by each letter. Click on "A" get all records in the DB that start with "A". I have it working no problem but i want to be able to add "#" so that the user can get all records that start with a Number.

For some reason the query i'm running won't grab any records that start with a number?

here is the query:

Taking Date Of Birth From User And Sending It To A Mysql Database
i have created a form that takes a users date of birth as 3 seperate values $day $month and $year i do not know how to combine these values into a single value called $dob.
I tries using just a singal value to take the date however it did not work, even after I had formated my database.

Displaying Data From Mysql Database In A Drop Down List On Form.
I'm trying to do is display data from two different mysql tables from the same database in a drop down list on a html form. I have a fixtures table with the player1(userid), player2(userid), gameid, game, score1 and 2, what I want is to use the userid to get the players first name and surname from the members table (as it is a unique id), I need to do this bit before displaying it in the drop down. I think i need 2 querys to do this but when I have tried it it just echo's a blank value or the userid not the forname and surname that I want. I'm using the fetch_array function but just can't see where I'm going wrong, Code:

Easy Way To Make "pages" From A Database List
If I list all the rows in a database and "LIMIT 20", how do I make it so I can go to, the next 20 rows? Say if I have 50 rows, and only want to show 20 per a page?

Sending Mail: Choice Between Sending Receipt, Or HTML Formatting
I'm using PHP's mail function to send out a message via email.

I would like for this email message to send a receipt when read as well as send an HTML formatted email. Both aspects are important to me.

I know this is a product of the mail header. This is the format I currently have:

mail(to, subject, body, "From: name <email>
Disposition-Notification-To: name<email>
Content-type:text/html;charset=utf-8");

This prompts the email program to send a reciept, but the email message is not in the HTML format, and even contains "Content-type:text/html;charset=utf-8" at the top of the body.

If I switch the order to this format:

mail(to, subject, body, "From: name <email>
Content-type:text/html;charset=utf-8
Disposition-Notification-To: name<email>");

This sends the email with HTML formatting but does not prompt the sending of the receipt. I also get "Disposition-Notification-To: name<email>" at the top of the email message.

This tells me there is a problem in the transition between the headers, which currently is "".

What am I doing wrong?

List Contents Of A Folder, Make List Of Links
Does anyone know how I can write a script that:

- reads in all the files in a particular directory
- displays the file names in a html list and makes a link of them:
<ul>
<li><a href="filelocation1">filename 1</li>
<li><a href="filelocation2">filename 1</li>
<li><a href="filelocation3">filename 1</li>
</ul>

etc.?

So basically it creates a list of links with the contents in that directory,
so you can download them from there.

Get List Of Messages From One Table, Message List Indicator From
I have two tables. One has a list of messages left by users using fields named mbxno for the mailbox and msgno for the message number. I have another table that has mailbox settings for each user that contains a field named "messagelist" to indicate if they want to be included on the message list or not.

What I'm trying to create is a list of the most-recent messages with a lookup on the users table to indicate whether a message in the list should be included in the message list based on the user's mailbox settings.

SELECT messages.msgno, messages.mbxno, users.messagelist FROM messages, users WHERE (users.messagelist = &#391;') ORDER BY msgno DESC LIMIT 100

What I'm getting, though is a list that looks like this:

mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 1114 msgno: 0412141623 msglist: 1

I think what's happening is that I'm using the wrong type of join and more rows are being created than necessary.

If I add "DISTINCT" to the query, I get a list of the most-recent messages as I expect, but the "messsagelist" value is sometimes wrong (again, probably because the data is getting jumbled). For example, the messagelist value for the second row (2214) should be 0, not 1.

mbxno: 1114 msgno: 0412141623 msglist: 1
mbxno: 2214 msgno: 0412141622 msglist: 1
mbxno: 2189 msgno: 0412141408 msglist: 1
mbxno: 0000 msgno: 0412141213 msglist: 1
mbxno: 0003 msgno: 0412141213 msglist: 1
mbxno: 2265 msgno: 0412132029 msglist: 1
mbxno: 0000 msgno: 0412131950 msglist: 1

How should I be doing this? If nothing else, what kind of join will work with a long list compared to a value from a short list?

Populating A List Box Or A Dropdown List Using Php And Odbc
I need to populate a list box and/or a dropdown list on a form. I have all
the bits and pieces together, all bar the code which takes the result of a
query and creates a list box.

Mailing List Manager, Send To List
I'm looking for a mailing list script (php) that has a function to let
users to reach out to all recipient on the list by simple send the
email to a specific maillist- address.

Mailman has this functionn but as a just got a webserver account I
can't use mailman nor install it.

<br> In Emails
I'm trying to sent an email with new lines in it but it only prints <br> tags rather than doing it? PHP Code:

Php Emails
When a client submits a form an email is dispatched via php to the email address. The problem is mainly with hotmail. When the email is sent, the message has a "!" sign next to it and at the top of the email the following message is listed:

The sender of this message, confirm+XCACaMXx@facebookmail.com, could not be verified by Sender ID. Learn more about Sender ID.

Some of my clients might get worried and delete the message. Is there a way I can overcome this problem ? Here is my script: Code:

Validating Emails
I have this page where if u add an email address it will send an email to u....PHP Code:

Grab Emails
Basically I had an old site which had a guest book where people could leave messages with their email addresses. Well I want to create a script where I can just copy the html into and the php script will grab all the emails for me. I got a program that does this but I want to be able to store those emails directly into my database.

Returned Emails
When sending email from a php script, is there a way to tell if the email was returned as undeliverable? My server uses MailEnable and when I send emails from php I never know if they got to their destination or were returned. I would think that if the email was returned, it should be put in the log files somewhere. But I couldnt find anything in my logs about returned mail. Any one know how I might do this?

Can PHP Recieve Emails?
I know that Perl can handle emails (ie you can forward emails to a perl script on your server and it can do something) but can the same be achieved with PHP? If so, how?

Get Emails From A POP Account.
I would like to make a script where i would get all the emails form a
POP# account and send it all to a email, what code would i use to do this ...

Emails & PHP / PEAR ?
Ive found this nifty script that does what I want - in PEAR.. (to send emails)

However i'm getting an error.. - Can anyone advise a suitable course
of action to correct this :-

Multiple Emails
Does anyone know how to send an online app form to more than one email address??? in php
here's my code but for only one email address: Code:

Html In Emails
I am having some trouble with html and emails. I have this script which is suppost to send a html email, although the html is just appearing in plain text. PHP Code:

HTML-emails
Does anybody know how to send an email in html-format? (content-type:text/html)


Copyright © 2005-08 www.BigResource.com, All rights reserved