472,794 Members | 3,565 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,794 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 2445

"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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.