This topic is locked

function BeforeAdd

12/3/2008 12:58:21 PM
PHPRunner General questions
C
caro author

In the CLASSIFIEDS Project, Table, "clreplay", Event Code:
function BeforeAdd(&$values,&$message,$inline)

{
results the following Problem:

User receives the mail with the FROM Field just the Sender Name, without the Sender Email. and that's the Problem.
Here is the Set of Codes for I have at:
function BeforeAdd(&$values,&$message,$inline)

{
global $dal;

$rs = $dal->clusers->Query("username='".$_SESSION["userinfo"]."'","");

$data = db_fetch_array($rs);
$email=$data["email"];

$subject=$values["Subject"];

$message=$values["Message"];
// To send HTML mail, the Content-type header must be set

$headers = "MIME-Version: 1.0" . "\r\n";

$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
// Additional headers

$headers .= "To: ".$data["username"]." <".$email.">" . "\r\n";

$headers .= "From: ".$values["SenderName"]." <".$values["SenderEmail"].">" . "\r\n";

//$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";

//$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
mail($email, $subject, $message, $headers);
return true;
[b]WHAT IS WRONG THERE???
Can somebody help with the right Codes??? Thanks.
The Problem regards- I guess, the Additional Header:

$headers .= "From: ".$values["SenderName"]." <".$values["SenderEmail"].">" . "\r\n";
Here is the "clreplay" Add Page itself in html Code, that might be helpfull:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD><TITLE>Clreply</TITLE>

<META content="text/html; charset=windows-1252" http-equiv=Content-Type><LINK

rel=stylesheet type=text/css

href="oldinclude/style.css">{$includes}

<META name=GENERATOR content="MSHTML 8.00.6001.18241"></HEAD>

<BODY bgColor=white {$bodyonload}>

<FORM encType=multipart/form-data method=post name=editform

action=clreply_add.php {$onsubmit}>{include_if_exists file="include/header.php"}&nbsp;{$message}&nbsp;
<TABLE border=0 cellPadding=2 width="70%" align=center>

<TBODY>

<TR>

<TD width=626 colSpan=2>{doevent name="AddOnLoad"}</TD></TR>

<TR>

<TD class=shade width=236>Email mitente</TD>

<TD width=388>{build_edit_control field="SederEmail" mode="add" value=$value_SederEmail}&nbsp;</TD></TR>

<TR>

<TD class=shade width=236>Nome mitente</TD>

<TD width=388>{build_edit_control field="SenderName" mode="add" value=$value_SenderName}&nbsp;</TD></TR>

<TR>

<TD class=shade width=236>Oggetto</TD>

<TD width=388>{build_edit_control field="Subject" mode="add" value=$value_Subject}&nbsp;&nbsp;<IMG

src="images/icon_required.gif"> </TD></TR>

<TR>

<TD class=shade width=236>Messaggio</TD>

<TD width=388>{build_edit_control field="Message" mode="add" value=$value_Message}&nbsp;&nbsp;<IMG

src="images/icon_required.gif"> </TD></TR>

<TR height=50>

<TD width=626 colSpan=2 align=middle><INPUT id=submit1 class=button value=Invia type=submit name=submit1>

<INPUT class=button value=Annulla type=reset> <input type=hidden name="a" value="added"></TD></TR></FORM><!-- legend -->

<TR height=50>

<TD width=626 colSpan=2 align=left>

<HR SIZE=1 width=300 noShade>

<BR><IMG src="images/icon_required.gif"> - Campo richiesto

</TD></TR></TBODY></TABLE>{include_if_exists file="include/footer.php"}&nbsp;{$linkdata}<script>SetToFirstControl();</script> </BODY></HTML>
Daniele

J
Jane 12/4/2008

Daniele,
I see what you're saying.

Here is the correct code:

$headers .= "From: ".$values["SenderName"]." <".$values["SederEmail"].">" . "\r\n";