Help please with mailing problem

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

  1. #1

    Default Help please with mailing problem

    I hope someone can help - (my PHP programmer colleague is away currently) -
    I know very little PHP.

    We have a shopping site (selling Whisky) where customers are required to
    register prior to purchasing goods. There is a facility whereby they are
    able to retrieve a lost username/password by entering either their email
    address or username - the full details are then emailed to them. (In the
    admin area the client is able to change the message body that is sent to the
    customer and if they wish to include the username and password they insert
    it by enclosing it with the hash symbol. ('Dear Sir, your username is
    #username#'). Everything seems setup OK in the admin area.

    However, when the customer receives the email the relevant fields are blank.
    I have pasted the code from the PHP page below, I wonder can anyone see any
    glaring errors that I could fix myself? (The text chunks are there as the
    site is in English and Welsh)

    Thanks, in anticipation,

    Ted

    ?
    if ($action=="getpass"){
    $db=new dbconnect;
    $query="SELECT recno,firstname,lastname,email,username,password FROM
    whisky_customers WHERE email='$info' OR username='$info' LIMIT 0,1";
    $db->runquery($query);
    if (mysql_numrows($db->result)==1){
    //send info
    $recno=$db->getfield(0,"recno");
    $firstname=$db->getfield(0,"firstname");
    $lastname=$db->getfield(0,"lastname");
    $email=$db->getfield(0,"email");
    $username=$db->getfield(0,"username");
    $password=$db->getfield(0,"password");
    $message=$textchunk->getchunk(83,$site_language);
    $message=str_replace("#firstname#",$firstname,$mes sage);
    $message=str_replace("#surname#",$surname,$message );
    $message=str_replace("#username#",$username,$messa ge);
    $message=str_replace("#password#",$password,$messa ge);
    $error=$textchunk->getchunk(86,$site_language);


    Ted Rogers Guest

  2. Similar Questions and Discussions

    1. Problem in Charset for ASP Mailing using CDONTS
      Hi Everyone! I have to send email in ASP form using CDONTS.newmail. The html body content having some accented letters like på dé. I have used the...
    2. mailing list ASP script problem
      Hi, I have a real simple mail script which sends out bulk mail to a subscriber list for a client I have. This script is a simple ASP page using...
    3. Mailing from CF
      I have a realtor that wants to use his excel list to generate a email to his clients about news, etc. 1) How do I convert an excel list into an...
    4. Mailing list set up!
      Hi, Well i am looking to set up a mailing list for my new organisational web site and the way i thought to do it is to use the insert record server...
    5. e-mailing pix
      don't know if this is the right forum for the question but can anyone tell me how do i put a photo in the body of an e-mail without adding it as an...
  3. #2

    Default Re: Help please with mailing problem

    "Ted Rogers" <ted@hotmail.com> wrote in message
    news:1073113708.63945.0@dyke.uk.clara.net...
    > I hope someone can help - (my PHP programmer colleague is away
    currently) -
    > I know very little PHP.
    >
    > We have a shopping site (selling Whisky) where customers are required to
    > register prior to purchasing goods. There is a facility whereby they are
    > able to retrieve a lost username/password by entering either their email
    > address or username - the full details are then emailed to them. (In the
    > admin area the client is able to change the message body that is sent to
    the
    > customer and if they wish to include the username and password they insert
    > it by enclosing it with the hash symbol. ('Dear Sir, your username is
    > #username#'). Everything seems setup OK in the admin area.
    >
    > However, when the customer receives the email the relevant fields are
    blank.
    > I have pasted the code from the PHP page below, I wonder can anyone see
    any
    > glaring errors that I could fix myself? (The text chunks are there as the
    > site is in English and Welsh)
    >
    > Thanks, in anticipation,
    >
    > Ted
    >
    > ?
    > if ($action=="getpass"){
    > $db=new dbconnect;
    > $query="SELECT recno,firstname,lastname,email,username,password FROM
    > whisky_customers WHERE email='$info' OR username='$info' LIMIT 0,1";
    > $db->runquery($query);
    > if (mysql_numrows($db->result)==1){
    > //send info
    > $recno=$db->getfield(0,"recno");
    > $firstname=$db->getfield(0,"firstname");
    > $lastname=$db->getfield(0,"lastname");
    > $email=$db->getfield(0,"email");
    > $username=$db->getfield(0,"username");
    > $password=$db->getfield(0,"password");
    > $message=$textchunk->getchunk(83,$site_language);
    > $message=str_replace("#firstname#",$firstname,$mes sage);
    > $message=str_replace("#surname#",$surname,$message );
    > $message=str_replace("#username#",$username,$messa ge);
    > $message=str_replace("#password#",$password,$messa ge);
    > $error=$textchunk->getchunk(86,$site_language);
    >
    Ted,

    You have sent the code that does the database query but not the emailing
    bit.!
    as a quick test, you can stick in a few debug lines

    echo "Hello from line xx<br />";

    If you put one inside the conditional ( just after the '//send info ' line),
    you can check to see if the data is actually being returned from the
    database.

    I would also echo each of the variables $message, $email $password etc to
    make sure that valid data is being returned.

    If all that is OK send the next bit - where the email is actually created

    Ron.


    Ron Guest

  4. #3

    Default Re: Help please with mailing problem

    > Ted,
    >
    > You have sent the code that does the database query but not the emailing
    > bit.!
    > as a quick test, you can stick in a few debug lines
    >
    > echo "Hello from line xx<br />";
    >
    > If you put one inside the conditional ( just after the '//send info '
    line),
    > you can check to see if the data is actually being returned from the
    > database.
    >
    > I would also echo each of the variables $message, $email $password etc to
    > make sure that valid data is being returned.
    >
    > If all that is OK send the next bit - where the email is actually created
    >
    > Ron.
    >
    Hi Ron

    I tried that test and the variables are not being returned. All I get is a
    list of lines 'Hello from line 12'etc. I guess this is where the problem
    lies.......

    Ted (disheartened)


    Ted Rogers Guest

  5. #4

    Default Re: Help please with mailing problem

    > Hi Ron
    >
    > I tried that test and the variables are not being returned. All I get is a
    > list of lines 'Hello from line 12'etc. I guess this is where the problem
    > lies.......
    >
    > Ted (disheartened)
    >
    If it would assist I'm pasting the full code for the page below - (I've just
    replaced the email adresses so the customer doesn't get spammed!). Here is a
    copy of the email received when making the request (which may also help - at
    least it demonstrates that the mailer works)

    Dear ,
    Thank you for your request, here are your account details in full:-

    Username:

    Password:

    Please visit [url]www.welsh-whisky.co.uk[/url] to log in. Thank you again for using
    Welsh Whisky.

    Yours Sincerely,

    Thanks for your help

    Ted

    <?
    if ($action=="getpass"){
    $db=new dbconnect;
    $query="SELECT recno,firstname,lastname,email,username,password FROM
    whisky_customers WHERE email='$info' OR username='$info' LIMIT 0,1";
    $db->runquery($query);
    if (mysql_numrows($db->result)==1){
    //send info
    $recno=$db->getfield(0,"recno");
    $firstname=$db->getfield(0,"firstname");
    $lastname=$db->getfield(0,"lastname");
    $email=$db->getfield(0,"email");
    $username=$db->getfield(0,"username");
    $password=$db->getfield(0,"password");
    $message=$textchunk->getchunk(83,$site_language);
    $message=str_replace("#firstname#",$firstname,$mes sage);
    $message=str_replace("#surname#",$surname,$message );
    $message=str_replace("#username#",$username,$messa ge);
    $message=str_replace("#password#",$password,$messa ge);
    $error=$textchunk->getchunk(86,$site_language);
    //Send Email to Us!
    $headers .= "From: Welsh Whisky <xxx@xxx.co.uk>\n";
    $headers .= "X-Sender: <$email>\n";
    $headers .= "X-Mailer: PHP\n"; // mailer
    $headers .= "X-Priority: 1\n"; // Urgent message!
    $headers .= "Return-Path: <info@xxx.com>\n"; // Return path for errors
    /* and now mail it */
    mail($email, $textchunk->getchunk(85,$site_language), $message,
    $headers);
    } else {
    //dont send info
    $error=$textchunk->getchunk(87,$site_language);
    }
    }//getpass


    //headings
    $headings_forgottenpassword=$textchunk->getchunk(78,$site_language);
    $headings_email=$textchunk->getchunk(59,$site_language);
    $headings_username=$textchunk->getchunk(79,$site_language);
    $headings_submit=$textchunk->getchunk(62,$site_language);

    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link href="../text/text.css" rel="stylesheet" type="text/css">
    </head>

    <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <p align="center" class="bodytext"><font color="#990000"><strong><? echo
    $error; ?></strong></font></p>
    <table width="100%" border="0" cellspacing="0" cellpadding="2">
    <tr>
    <td height="30" bgcolor="#006699" class="text12"><font
    color="#FFFFFF"><strong><u><? echo $headings_forgottenpassword;
    ?></u></strong></font></td>
    </tr>
    </table>
    <table width="100%" border="0" align="center" cellpadding="4"
    cellspacing="1" bgcolor="#006699">
    <tr>
    <td valign="top" bgcolor="#FFFFFF" class="bodytext"> <table width="100%"
    border="0" cellspacing="1" cellpadding="2">
    <form name="Login" method="POST" action="index.php">
    <tr class="bodytext">
    <td width="75" height="30" align="right"><? echo
    $headings_email; ?>/<? echo $headings_username; ?></td>
    <td height="30">
    <input name="info" type="text" class="form" id="info"
    size="20">
    </td>
    </tr>
    <tr>
    <td height="30">&nbsp;</td>
    <td height="30">
    <input name="Submit" type="submit" class="form" value="<? echo
    $headings_submit; ?>">
    <input name="action" type="hidden" id="action"
    value="getpass">
    <input name="article" type="hidden" id="article" value="<?
    echo $article; ?>"></td>
    </tr>
    </form>
    </table> </td>
    </tr>
    </table>
    </body>
    </html>


    Ted Rogers 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