Getting 3 emails from one mail()

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default Getting 3 emails from one mail()

    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 <Webmaster@domain.com>\n";
    $headers .= "X-Sender: <Webmaster@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: <Webmaster@domain.com>\n";
    $headers .= "bcc: [email]mary@herdomain.com[/email]";
    $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 = "william@mydomain.net";
    mail($to, $subject, $message, $headers);
    }
    else if (($active > 0) AND ($ver == "1")) {
    echo "Your listing is already activated.<BR>";
    }
    }
    ?>


    Wm Guest

  2. Similar Questions and Discussions

    1. Print Multiple Mail App Emails as One PDF
      I'm pretty late to the topic but am having the same issue like Keith. Using the latest Mail.app i need to compile roughly 1900 emails that are...
    2. Mail component to retrieve mail from Hotmail, Yahoo, gmail..etc?
      I am not sure these web based mail support POP3 or IMAP4. Is there any mail component out there that can retrieve mail from these services? --...
    3. #25357 [Com]: Mail() function is loosing cahracters when sending mail
      ID: 25357 Comment by: dj_canard at yahoo dot com Reported By: pjsmith at microtech dot co dot gg Status: Bogus...
    4. #25195 [NEW]: Warning: mail(): Could not execute mail delivery program ...
      From: mhawkins at ukeu dot com Operating system: Solaris 8 PHP version: Irrelevant PHP Bug Type: Mail related Bug...
    5. Import Mail.app emails into MS Outlook
      Hi all, Is it possible to import saved emails in Mail.app (OS X) into Microsoft Outlook? I know I can drag a mailbox from Mail onto the desktop,...
  3. #2

    Default Re: Getting 3 emails from one mail()


    "Wm" <LAshooter@hotmail.com> schreef in bericht
    news:nVd3b.3140344$mA4.430269@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


    floortje Guest

  4. #3

    Default Re: Getting 3 emails from one mail()

    "floortje" <floortje@floortje.floortje> wrote in message
    news:3f4db753$0$76465$e4fe514c@dreader8.news.xs4al l.nl...
    > "Wm" <LAshooter@hotmail.com> schreef in bericht
    > news:nVd3b.3140344$mA4.430269@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


    Wm Guest

  5. #4

    Default Re: Getting 3 emails from one mail()

    On Thu, 28 Aug 2003 15:13:51 +0200
    "floortje" <floortje@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. "
    [url]www.quispiam.com[/url] | - Jeremy S. Anderson
    Matthew Vickers Guest

  6. #5

    Default Re: Getting 3 emails from one mail()


    "Wm" <LAshooter@hotmail.com> schreef in bericht
    news:rim3b.32590$hf5.177492@news.easynews.com...
    > "floortje" <floortje@floortje.floortje> wrote in message
    > news:3f4db753$0$76465$e4fe514c@dreader8.news.xs4al l.nl...
    > > "Wm" <LAshooter@hotmail.com> schreef in bericht
    > > news:nVd3b.3140344$mA4.430269@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


    floortje Guest

  7. #6

    Default Re: Getting 3 emails from one mail()

    Just wondering: why even have a while() if you only expect one result?

    --
    // DvDmanDT
    MSN: [email]dvdmandt@hotmail.com[/email]
    Mail: [email]dvdmandt@telia.com[/email]
    "kicksy" <slapkicksy@blueyonder.co.ukNOSPAM> skrev i meddelandet
    news:Y4n3b.6544$us2.61719595@news-text.cableinet.net...
    >
    > "Wm" <LAshooter@hotmail.com> wrote in message
    > news:nVd3b.3140344$mA4.430269@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 <Webmaster@domain.com>\n";
    > > $headers .= "X-Sender: <Webmaster@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: <Webmaster@domain.com>\n";
    > > $headers .= "bcc: [email]mary@herdomain.com[/email]";
    > > $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 = "william@mydomain.net";
    > > mail($to, $subject, $message, $headers);
    > > }
    > > else if (($active > 0) AND ($ver == "1")) {
    > > echo "Your listing is already activated.<BR>";
    > > }
    > > }
    > > ?>
    > >
    > >
    >
    >

    DvDmanDT Guest

  8. #7

    Default Re: Getting 3 emails from one mail()

    "DvDmanDT" <dvdmandt@telia.com> wrote in message
    news:zz24b.26258$dP1.66398@newsc.telia.net...
    > Just wondering: why even have a while() if you only expect one result?
    >
    > --
    > // DvDmanDT
    > MSN: [email]dvdmandt@hotmail.com[/email]
    > Mail: [email]dvdmandt@telia.com[/email]
    > "kicksy" <slapkicksy@blueyonder.co.ukNOSPAM> skrev i meddelandet
    > news:Y4n3b.6544$us2.61719595@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" <LAshooter@hotmail.com> wrote in message
    > > news:nVd3b.3140344$mA4.430269@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 <Webmaster@domain.com>\n";
    > > > $headers .= "X-Sender: <Webmaster@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: <Webmaster@domain.com>\n";
    > > > $headers .= "bcc: [email]mary@herdomain.com[/email]";
    > > > $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 = "william@mydomain.net";
    > > > mail($to, $subject, $message, $headers);
    > > > }
    > > > else if (($active > 0) AND ($ver == "1")) {
    > > > echo "Your listing is already activated.<BR>";
    > > > }
    > > > }
    > > > ?>
    > > >
    > > >
    > >
    > >
    >
    >

    Wm Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139