Ask a Question related to PHP Development, Design and Development.
-
Ted Rogers #1
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
-
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... -
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... -
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... -
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... -
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... -
Ron #2
Re: Help please with mailing problem
"Ted Rogers" <ted@hotmail.com> wrote in message
news:1073113708.63945.0@dyke.uk.clara.net...currently) -> I hope someone can help - (my PHP programmer colleague is awaythe> 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 toblank.> 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 areany> I have pasted the code from the PHP page below, I wonder can anyone seeTed,> 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);
>
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
-
Ted Rogers #3
Re: Help please with mailing problem
> Ted,
line),>
> 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 'Hi Ron> 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.
>
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
-
Ted Rogers #4
Re: Help please with mailing problem
> Hi Ron
If it would assist I'm pasting the full code for the page below - (I've just>
> 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)
>
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"> </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



Reply With Quote

