473,326 Members | 2,732 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Getting 3 emails from one mail()

Wm
I'm totally clueless on this one -- I'm getting 3 copies of every Email (in
plain text, not HTML as expected), from a single mail() line... Can anyone
tell me what might be causing the duplicates??

Thanx!
Wm
<?PHP
include('dbconn.php');
$query="SELECT
artistID,active,email,firstname,lastname,city,stat e,mentor from artists
WHERE artistID='$artistID'";
$result=mysql_query($query) or die(mysql_error("Could not execute
query."));
while($row = mysql_fetch_array($result)) {
$email = $row['email'];
$notactive = $row['active'];
$firstname = $row['firstname'];
$lastname = $row['lastname'];
$city = $row['city'];
$state = $row['state'];
$mentor = $row['mentor'];

if ($mentor == "1") {
$class = "as a Mentor";
}
else {
$class = "as an Assistant";
}

if (($notactive == "0") AND ($ver == "1")) {
mysql_query("UPDATE artists SET active='1' WHERE artistID =
'$artistID' LIMIT 1");
echo "Your listing has been successfully activated -- welcome to
Makeup Mentors!<BR>
Please tell a friend about this resource!";
// generate Email
$headers = "From: domain.com <We*******@domain.com>\n";
$headers .= "X-Sender: <We*******@domain.com>\n";
$headers .= "X-Mailer: domain.com\n"; //mailer
$headers .= "X-MSMail-Priority: Normal\n";
$headers .= "X-Priority: 3\n"; //1 UrgentMessage, 3 Normal
$headers .= "Return-Path: <We*******@domain.com>\n";
$headers .= "bcc: ma**@herdomain.com";
$headers .= "Content-Type: text/html; charset=iso-8859-1\n";
$city = stripslashes($city);
$message = "
<p align=\"left\">domain.com has just activated the following artist
$class:</p>
<p align=\"left\">Name: $firstname $lastname<br>
Location: $city, $state</p>
<p>&nbsp;</p>
<p align=\"left\">Webmaster<br>
<A HREF=\"http://www.domain.com\">www.domain.com</A></p>";
$subject = "Makeup Mentors listing verification";
$to = "wi*****@mydomain.net";
mail($to, $subject, $message, $headers);
}
else if (($active > 0) AND ($ver == "1")) {
echo "Your listing is already activated.<BR>";
}
}
?>
Jul 16 '05 #1
6 2472

"Wm" <LA*******@hotmail.com> schreef in bericht
news:nV**********************@news.easynews.com...
I'm totally clueless on this one -- I'm getting 3 copies of every Email (in plain text, not HTML as expected), from a single mail() line... Can anyone
tell me what might be causing the duplicates??

Thanx!
Wm

Hmm I dont have the time to figure out the { {{{{ }}}}} part .... maybe u
should try some structure.
did u try a echo msql_num_rows($result); ? maybe u will find ur getting 3
results for some odd reason. Did u set primary key unique ?

Cya

Floortje
Jul 16 '05 #2
Wm
"floortje" <fl******@floortje.floortje> wrote in message
news:3f***********************@dreader8.news.xs4al l.nl...
"Wm" <LA*******@hotmail.com> schreef in bericht
news:nV**********************@news.easynews.com...
I'm totally clueless on this one -- I'm getting 3 copies of every Email (in plain text, not HTML as expected), from a single mail() line... Can anyone tell me what might be causing the duplicates??

Hmm I dont have the time to figure out the { {{{{ }}}}} part .... maybe u
should try some structure.
did u try a echo msql_num_rows($result); ? maybe u will find ur getting 3
results for some odd reason. Did u set primary key unique ?

Cya

Floortje


Yes, I have an autonumber field as a primary key. Every single registrant is
generating exactly 3 emails so I know that it's not duplicate records, it
must be something about my code that is looping...??

Wm
Jul 16 '05 #3

"Wm" <LA*******@hotmail.com> schreef in bericht
news:ri********************@news.easynews.com...
"floortje" <fl******@floortje.floortje> wrote in message
news:3f***********************@dreader8.news.xs4al l.nl...
"Wm" <LA*******@hotmail.com> schreef in bericht
news:nV**********************@news.easynews.com...
I'm totally clueless on this one -- I'm getting 3 copies of every
Email
(in plain text, not HTML as expected), from a single mail() line... Can anyone tell me what might be causing the duplicates??
Hmm I dont have the time to figure out the { {{{{ }}}}} part .... maybe u should try some structure.
did u try a echo msql_num_rows($result); ? maybe u will find ur getting 3 results for some odd reason. Did u set primary key unique ?

Cya

Floortje


Yes, I have an autonumber field as a primary key. Every single registrant

is generating exactly 3 emails so I know that it's not duplicate records, it
must be something about my code that is looping...??

Did u try msql_num_rows($result); ?? U could try print_r($result); ... that
will give ya more info on the content of the array
Jul 16 '05 #4
On Thu, 28 Aug 2003 15:13:51 +0200
"floortje" <fl******@floortje.floortje> wrote:

<snip>
generating exactly 3 emails so I know that it's not duplicate
records, it must be something about my code that is looping...??

Did u try msql_num_rows($result); ?? U could try print_r($result); ...
that will give ya more info on the content of the array

Do you mean print_r($row) ? $result is not an array, its an integer.
Matt
--
Quispiam Power Computing | "There are two major products that come out
Pendle Hill, Australia | of Berkeley: LSD and UNIX. We don't believe
+61 2 9688 2894 | this to be a coincidence. "
www.quispiam.com | - Jeremy S. Anderson
Jul 16 '05 #5
Just wondering: why even have a while() if you only expect one result?

--
// DvDmanDT
MSN: dv******@hotmail.com
Mail: dv******@telia.com
"kicksy" <sl********@blueyonder.co.ukNOSPAM> skrev i meddelandet
news:Y4*********************@news-text.cableinet.net...

"Wm" <LA*******@hotmail.com> wrote in message
news:nV**********************@news.easynews.com...
I'm totally clueless on this one -- I'm getting 3 copies of every Email

(in
plain text, not HTML as expected), from a single mail() line... Can anyone tell me what might be causing the duplicates??

Thanx!
Wm
<?PHP
include('dbconn.php');
$query="SELECT
artistID,active,email,firstname,lastname,city,stat e,mentor from artists
WHERE artistID='$artistID'";
$result=mysql_query($query) or die(mysql_error("Could not execute
query."));


I'm gonna suggest doing this.
$row=mysql_fetch_array($result);
if (mysql_num_rows($row)==1)//1 result returned
{
// while loop
}
else
{
echo "too many results returned";
}

This way you can see if you are getting too many...
:P
while($row = mysql_fetch_array($result)) {
$email = $row['email'];
$notactive = $row['active'];
$firstname = $row['firstname'];
$lastname = $row['lastname'];
$city = $row['city'];
$state = $row['state'];
$mentor = $row['mentor'];

if ($mentor == "1") {
$class = "as a Mentor";
}
else {
$class = "as an Assistant";
}

if (($notactive == "0") AND ($ver == "1")) {
mysql_query("UPDATE artists SET active='1' WHERE artistID =
'$artistID' LIMIT 1");
echo "Your listing has been successfully activated -- welcome to Makeup Mentors!<BR>
Please tell a friend about this resource!";
// generate Email
$headers = "From: domain.com <We*******@domain.com>\n";
$headers .= "X-Sender: <We*******@domain.com>\n";
$headers .= "X-Mailer: domain.com\n"; //mailer
$headers .= "X-MSMail-Priority: Normal\n";
$headers .= "X-Priority: 3\n"; //1 UrgentMessage, 3 Normal
$headers .= "Return-Path: <We*******@domain.com>\n";
$headers .= "bcc: ma**@herdomain.com";
$headers .= "Content-Type: text/html; charset=iso-8859-1\n";
$city = stripslashes($city);
$message = "
<p align=\"left\">domain.com has just activated the following artist $class:</p>
<p align=\"left\">Name: $firstname $lastname<br>
Location: $city, $state</p>
<p>&nbsp;</p>
<p align=\"left\">Webmaster<br>
<A HREF=\"http://www.domain.com\">www.domain.com</A></p>";
$subject = "Makeup Mentors listing verification";
$to = "wi*****@mydomain.net";
mail($to, $subject, $message, $headers);
}
else if (($active > 0) AND ($ver == "1")) {
echo "Your listing is already activated.<BR>";
}
}
?>


Jul 16 '05 #6
Wm
"DvDmanDT" <dv******@telia.com> wrote in message
news:zz*******************@newsc.telia.net...
Just wondering: why even have a while() if you only expect one result?

--
// DvDmanDT
MSN: dv******@hotmail.com
Mail: dv******@telia.com
"kicksy" <sl********@blueyonder.co.ukNOSPAM> skrev i meddelandet
news:Y4*********************@news-text.cableinet.net...

Good question! That's the way I've done other queries, so I copied the lines
that worked on other pages. I still get confused on all the options for
fetch_array, etc...

BTW, I'm still getting 1 result from the query, yet consistently receiving 3
emails...

Wm
"Wm" <LA*******@hotmail.com> wrote in message
news:nV**********************@news.easynews.com...
I'm totally clueless on this one -- I'm getting 3 copies of every Email
(in
plain text, not HTML as expected), from a single mail() line... Can
anyone tell me what might be causing the duplicates??

Thanx!
Wm
<?PHP
include('dbconn.php');
$query="SELECT
artistID,active,email,firstname,lastname,city,stat e,mentor from
artists WHERE artistID='$artistID'";
$result=mysql_query($query) or die(mysql_error("Could not execute
query."));


I'm gonna suggest doing this.
$row=mysql_fetch_array($result);
if (mysql_num_rows($row)==1)//1 result returned
{
// while loop
}
else
{
echo "too many results returned";
}

This way you can see if you are getting too many...
:P
while($row = mysql_fetch_array($result)) {
$email = $row['email'];
$notactive = $row['active'];
$firstname = $row['firstname'];
$lastname = $row['lastname'];
$city = $row['city'];
$state = $row['state'];
$mentor = $row['mentor'];

if ($mentor == "1") {
$class = "as a Mentor";
}
else {
$class = "as an Assistant";
}

if (($notactive == "0") AND ($ver == "1")) {
mysql_query("UPDATE artists SET active='1' WHERE artistID =
'$artistID' LIMIT 1");
echo "Your listing has been successfully activated -- welcome to Makeup Mentors!<BR>
Please tell a friend about this resource!";
// generate Email
$headers = "From: domain.com <We*******@domain.com>\n";
$headers .= "X-Sender: <We*******@domain.com>\n";
$headers .= "X-Mailer: domain.com\n"; //mailer
$headers .= "X-MSMail-Priority: Normal\n";
$headers .= "X-Priority: 3\n"; //1 UrgentMessage, 3 Normal
$headers .= "Return-Path: <We*******@domain.com>\n";
$headers .= "bcc: ma**@herdomain.com";
$headers .= "Content-Type: text/html;
charset=iso-8859-1\n"; $city = stripslashes($city);
$message = "
<p align=\"left\">domain.com has just activated the following

artist $class:</p>
<p align=\"left\">Name: $firstname $lastname<br>
Location: $city, $state</p>
<p>&nbsp;</p>
<p align=\"left\">Webmaster<br>
<A HREF=\"http://www.domain.com\">www.domain.com</A></p>";
$subject = "Makeup Mentors listing verification";
$to = "wi*****@mydomain.net";
mail($to, $subject, $message, $headers);
}
else if (($active > 0) AND ($ver == "1")) {
echo "Your listing is already activated.<BR>";
}
}
?>



Jul 16 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: dan glenn | last post by:
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...
40
by: ian | last post by:
Hi, I'm a newbie (oh no I can here you say.... another one...) How can I get Python to send emails using the default windows email client (eg outlook express)? I thought I could just do the...
2
by: Mr. x | last post by:
Hello, I am sending emails with Hebrew contents. When receiving emails - I cannot see the Hebrew characters (it is not outlook express configuration, because when receiving emails from friends -...
2
by: Joey | last post by:
I am currently developing a C# asp.net application where users are required to register. The application then generates a simple, plain text email and sends it to the new user. I have been...
9
by: Dave | last post by:
I searched the usenet and some mail archives and tried various techniques, but I can't seem to get the .NET 2.0 SDK to work with python. I'm a total newbie when it comes to python installs. I...
21
by: maya | last post by:
hi, I'm designing an HTML email for a client.. I know general guidelines (no CSS, no JavaScript... although I do use limited CSS, inside tags (as in <span style=".."we do this at work and it...
5
by: Jai | last post by:
Hi, I am in a problem of sending mass emails(newsletter) to my website members. Actually my problem is this: I want to send newsletter to my website members. But I had given a facility for...
10
by: crazycooter | last post by:
I found an old thread on this (http://groups.google.com/group/alt.php/ browse_thread/thread/751edb9c723316c4/ea9bf92a9c6b807c?lnk=gst&q=mail() +duplicate&rnum=7#ea9bf92a9c6b807c), but there didnt...
0
by: =?Utf-8?B?Q2hhcmxlcw==?= | last post by:
Like many people, I normally use Yahoo! Mail via the web and like to keep all my emails stored on the Yahoo! server. However sometimes I can’t get access to a PC/the web and I download my emails...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.