For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > May 2007 > Using SendMail in Forms w/PHP HTML









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Using SendMail in Forms w/PHP HTML
jcage@lycos.com

2007-04-21, 6:57 pm

Is there any tutorials online for sending email through forms? I can
send an email as well as write to my MySQL database from home with the
following code but not at work. I think there might be something I'm
missing header-wise that keeps me from making this work on my work
system. I'm using apache 1.3, PHP 4.1 (best the IT guys could do
though I'm using 5.x at home), and MySQL as the database. Thanks VERY
much for any help or pointers to a good tutorial. I'm trying to
provide an input form that writes to the database as well as emails
the recipient letting them know there's been activity. Thanks, John

My form PHP code is as follows:

Input form 1:
<html>
<body>
<form method="post" action="messaging2.php">
<input type="hidden" name="id" value="NULL">
<center>
<table border="8">
<tr>
<td>Date:</td>
<td align="left"><input type="text" name="date" size="14"
maxlength="16" value="<? print strftime("%m/%d/%Y %H:%M"); ?>"></
td>
</tr>
<tr>
<td>Your Name:<font color=red>*</font></td><td align="left"><input
type="text" name="name" size="14" maxlength="20" value=""></td>
</tr>
<tr>
<td>Subject:<font color=red>*</font></td><td align="left"><input
type="text" name="subject" size="14" maxlength="20" value=""></td>
</tr>
<tr>
<td>Message For:<font color=red>*</font></td>
<td><select name="to" style='width: 110px;'>
<option value = ""></option>
<option value ="joe@lycos.com">Joe</option>
<option value ="randy@gmail.com">Randy</option>
</td>
</tr>
<tr>
<td nowrap>
Message:<font color=red>*</font></div>
</td>
<td>
<textarea type="text" name="text" cols="35" rows="5"></textarea>
</tr>
</td>
<tr>
<td colspan="2" align="center"><input type="submit" value="Enter"></
td>
</tr>
</table>
</form>
</center><p>
</body>
</html>

Input form 2:
<html>
<font color="#990099" size="+1"><span
style="font-size:18"><p>
<TABLE cellSpacing=0 cellPadding=10 width="95%"
align=center border=8">
<TBODY><TR><TD vAlign=top align=left><P><FONT
face=arial color=bright white><b>
<?php
require_once('generic_connect.php');
$DBName = "messages";
$table = "messages_tbl";

$id = $_POST['id'];
$date = $_POST['date'];
$name = $_POST['name'];
$subject = $_POST['subject'];
$to = $_POST['to'];
$text = $_POST['text'];

mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect
to database"); // make connection to database
mysql_select_db($DBName) or die("Unable to select database
$DBName"); // select database
$sqlquery = "INSERT INTO $table VALUES('$id', '$date', '$name',
'$subject', '$to', '$text')";
if ($results = mysql_query($sqlquery)) {

$to = stripslashes($to)."\r\n";
$subject = stripslashes($subject);
$text = stripslashes($text);
mail($to, $subject, $text, "From: admin@work.com");
}

mysql_close();
print "<center><table border=\"0\" width=\"500\"><tr><td>";
print "<p><font face=\"verdana\" size=\"+0\">
<center>You Just Entered This Information into the
Database<p><blockquote>";
print "Date: $date<p>Your Name: $name<p>Message For:$to<p>Subject:
$subject<p>Message:$text</blockquote></td></tr></table>
</CENTER>
</html>";
?>

</FONT></CENTER></b>
</H3></TD></TR></TBODY></TABLE>
</html><p>

portion of php.ini file that deals with mail configuration:

[mail function]
; For Win32 only.
SMTP = mail.work.com
smtp_port = 25

Jerry Stuckle

2007-04-21, 9:58 pm

jcage@lycos.com wrote:
> Is there any tutorials online for sending email through forms? I can
> send an email as well as write to my MySQL database from home with the
> following code but not at work. I think there might be something I'm
> missing header-wise that keeps me from making this work on my work
> system. I'm using apache 1.3, PHP 4.1 (best the IT guys could do
> though I'm using 5.x at home), and MySQL as the database. Thanks VERY
> much for any help or pointers to a good tutorial. I'm trying to
> provide an input form that writes to the database as well as emails
> the recipient letting them know there's been activity. Thanks, John
>
> My form PHP code is as follows:
>
> Input form 1:
> <html>
> <body>
> <form method="post" action="messaging2.php">
> <input type="hidden" name="id" value="NULL">
> <center>
> <table border="8">
> <tr>
> <td>Date:</td>
> <td align="left"><input type="text" name="date" size="14"
> maxlength="16" value="<? print strftime("%m/%d/%Y %H:%M"); ?>"></
> td>
> </tr>
> <tr>
> <td>Your Name:<font color=red>*</font></td><td align="left"><input
> type="text" name="name" size="14" maxlength="20" value=""></td>
> </tr>
> <tr>
> <td>Subject:<font color=red>*</font></td><td align="left"><input
> type="text" name="subject" size="14" maxlength="20" value=""></td>
> </tr>
> <tr>
> <td>Message For:<font color=red>*</font></td>
> <td><select name="to" style='width: 110px;'>
> <option value = ""></option>
> <option value ="joe@lycos.com">Joe</option>
> <option value ="randy@gmail.com">Randy</option>
> </td>
> </tr>
> <tr>
> <td nowrap>
> Message:<font color=red>*</font></div>
> </td>
> <td>
> <textarea type="text" name="text" cols="35" rows="5"></textarea>
> </tr>
> </td>
> <tr>
> <td colspan="2" align="center"><input type="submit" value="Enter"></
> td>
> </tr>
> </table>
> </form>
> </center><p>
> </body>
> </html>
>
> Input form 2:
> <html>
> <font color="#990099" size="+1"><span
> style="font-size:18"><p>
> <TABLE cellSpacing=0 cellPadding=10 width="95%"
> align=center border=8">
> <TBODY><TR><TD vAlign=top align=left><P><FONT
> face=arial color=bright white><b>
> <?php
> require_once('generic_connect.php');
> $DBName = "messages";
> $table = "messages_tbl";
>
> $id = $_POST['id'];
> $date = $_POST['date'];
> $name = $_POST['name'];
> $subject = $_POST['subject'];
> $to = $_POST['to'];
> $text = $_POST['text'];
>
> mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect
> to database"); // make connection to database
> mysql_select_db($DBName) or die("Unable to select database
> $DBName"); // select database
> $sqlquery = "INSERT INTO $table VALUES('$id', '$date', '$name',
> '$subject', '$to', '$text')";
> if ($results = mysql_query($sqlquery)) {
>
> $to = stripslashes($to)."\r\n";
> $subject = stripslashes($subject);
> $text = stripslashes($text);
> mail($to, $subject, $text, "From: admin@work.com");
> }
>
> mysql_close();
> print "<center><table border=\"0\" width=\"500\"><tr><td>";
> print "<p><font face=\"verdana\" size=\"+0\">
> <center>You Just Entered This Information into the
> Database<p><blockquote>";
> print "Date: $date<p>Your Name: $name<p>Message For:$to<p>Subject:
> $subject<p>Message:$text</blockquote></td></tr></table>
> </CENTER>
> </html>";
> ?>
>
> </FONT></CENTER></b>
> </H3></TD></TR></TBODY></TABLE>
> </html><p>
>
> portion of php.ini file that deals with mail configuration:
>
> [mail function]
> ; For Win32 only.
> SMTP = mail.work.com
> smtp_port = 25
>


You mean other than this is a spammer's dream. All I have to do is post
a form to your site with the 'to' field filled in (and others) and I
send email anywhere I want on your nickel.

Among other things - NEVER put the email address in you form - even as a
hidden field.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
shimmyshack

2007-04-22, 7:57 am

On Apr 22, 12:23 am, j...@lycos.com wrote:
> Is there any tutorials online for sending email through forms? I can
> send an email as well as write to my MySQL database from home with the
> following code but not at work. I think there might be something I'm
> missing header-wise that keeps me from making this work on my work
> system. I'm using apache 1.3, PHP 4.1 (best the IT guys could do
> though I'm using 5.x at home), and MySQL as the database. Thanks VERY
> much for any help or pointers to a good tutorial. I'm trying to
> provide an input form that writes to the database as well as emails
> the recipient letting them know there's been activity. Thanks, John
>
> My form PHP code is as follows:
>
> Input form 1:
> <html>
> <body>
> <form method="post" action="messaging2.php">
> <input type="hidden" name="id" value="NULL">
> <center>
> <table border="8">
> <tr>
> <td>Date:</td>
> <td align="left"><input type="text" name="date" size="14"
> maxlength="16" value="<? print strftime("%m/%d/%Y %H:%M"); ?>"></
> td>
> </tr>
> <tr>
> <td>Your Name:<font color=red>*</font></td><td align="left"><input
> type="text" name="name" size="14" maxlength="20" value=""></td>
> </tr>
> <tr>
> <td>Subject:<font color=red>*</font></td><td align="left"><input
> type="text" name="subject" size="14" maxlength="20" value=""></td>
> </tr>
> <tr>
> <td>Message For:<font color=red>*</font></td>
> <td><select name="to" style='width: 110px;'>
> <option value = ""></option>
> <option value ="j...@lycos.com">Joe</option>
> <option value ="r...@gmail.com">Randy</option>
> </td>
> </tr>
> <tr>
> <td nowrap>
> Message:<font color=red>*</font></div>
> </td>
> <td>
> <textarea type="text" name="text" cols="35" rows="5"></textarea>
> </tr>
> </td>
> <tr>
> <td colspan="2" align="center"><input type="submit" value="Enter"></
> td>
> </tr>
> </table>
> </form>
> </center><p>
> </body>
> </html>
>
> Input form 2:
> <html>
> <font color="#990099" size="+1"><span
> style="font-size:18"><p>
> <TABLE cellSpacing=0 cellPadding=10 width="95%"
> align=center border=8">
> <TBODY><TR><TD vAlign=top align=left><P><FONT
> face=arial color=bright white><b>
> <?php
> require_once('generic_connect.php');
> $DBName = "messages";
> $table = "messages_tbl";
>
> $id = $_POST['id'];
> $date = $_POST['date'];
> $name = $_POST['name'];
> $subject = $_POST['subject'];
> $to = $_POST['to'];
> $text = $_POST['text'];
>
> mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect
> to database"); // make connection to database
> mysql_select_db($DBName) or die("Unable to select database
> $DBName"); // select database
> $sqlquery = "INSERT INTO $table VALUES('$id', '$date', '$name',
> '$subject', '$to', '$text')";
> if ($results = mysql_query($sqlquery)) {
>
> $to = stripslashes($to)."\r\n";
> $subject = stripslashes($subject);
> $text = stripslashes($text);
> mail($to, $subject, $text, "From: a...@work.com");
>
> }
>
> mysql_close();
> print "<center><table border=\"0\" width=\"500\"><tr><td>";
> print "<p><font face=\"verdana\" size=\"+0\">
> <center>You Just Entered This Information into the
> Database<p><blockquote>";
> print "Date: $date<p>Your Name: $name<p>Message For:$to<p>Subject:
> $subject<p>Message:$text</blockquote></td></tr></table>
> </CENTER>
> </html>";
> ?>
>
> </FONT></CENTER></b>
> </H3></TD></TR></TBODY></TABLE>
> </html><p>
>
> portion of php.ini file that deals with mail configuration:
>
> [mail function]
> ; For Win32 only.
> SMTP = mail.work.com
> smtp_port = 25


as you do not need to send the email addresses from the browser to the
server in order for the server to use the value - which sent the
emails to the browser in the first place - why not have an array in
your logic, $arrEmailAddresses = array( 'joe'=>'joe@server.com',
'bob'=>'bob@server.com' ); and simply have values joe and bob... in
your webpage and use the posted value - provided it exists in the
array obtianed by array_keys($arrEmailAddresses) as the index you then
uuse to obtain the email.

use mysql_real_escape_string and if you cant - cos your it people dont
value the aggregated learning thats gone into php5 over the attraction
of back compatibility, then use the nearest equivalent, to stop sql
injection, when querying your db, or else suffer the consequences.
Dont just print back the name subject etc.. back to the webpage, first
filter them with htmlentities or suchlike, or you have just made your
whole website insecure, and potentially allowed users access to each
others data in the database, even over SSL etc... etc... google for
cross site scripting.
dont allow email header injection, which means validate the variables
for to subject etc... or you will still be sending email to all and
sundry despite the steps above.

my advice, stay away from using mail(), use an authenticated
connection to an smtp server, using an account for the purpose of
sending email from this form, and use a decent library like phpmailer
to handle sending the mail, as it will be more secure.

use a captcha or once you have been idnetified, spammers will be on
you sending and sending. This doesnt allow mail sending unless the
captcha is solved, its not foolproof by any means, but it makes things
harder for the scripts out there. Big name spammers will find it easy
to circumvent the captchas, but youve at least made the effort.

as to why it doesnt work on your work system, -f flag is sometimes
seen as a problem, if you authanticate to an smtp server the vaguaries
of setups at home vs work will be moot.

jcage@lycos.com

2007-04-22, 9:57 pm

> On Apr 22, 12:23 am, j...@lycos.com wrote:


Thanks for the informative replies, gents. I forgot to mention that
for this application that it was intended to work off a server on the
company intranet so has some insulated security based on that (I can't
access it from home). It began as a means to keep an electronic log
for a 'testy' piece of equipment where messages could be passed from
those who don't currently have access to any email. Their entries
make it to the database log just fine where they can be queried and
read but to ensure speedy remedies or responses to issues (by those
who may otherwise 'forget' to check the database for any new entries),
the ability to send an email as a teaser seemed like a good idea.
Hence, the struggle to get some semblence of this working.

thanks again,
John

shimmyshack

2007-04-22, 9:57 pm

On 22 Apr, 16:05, j...@lycos.com wrote:
>
> Thanks for the informative replies, gents. I forgot to mention that
> for this application that it was intended to work off a server on the
> company intranet so has some insulated security based on that (I can't
> access it from home). It began as a means to keep an electronic log
> for a 'testy' piece of equipment where messages could be passed from
> those who don't currently have access to any email. Their entries
> make it to the database log just fine where they can be queried and
> read but to ensure speedy remedies or responses to issues (by those
> who may otherwise 'forget' to check the database for any new entries),
> the ability to send an email as a teaser seemed like a good idea.
> Hence, the struggle to get some semblence of this working.
>
> thanks again,
> John


I see, although it is protected to a degree, the way the values are
printed to the screen in fact makes it vunerable to attack from
outside, unfortunately. It's not a massive problem, but you should use
best practise and escape and filter wherever input is printed to
screen or obtained from a source like a user or database and then
used. This kind of webpage is what an external attacker is looking for
when s/he wants to gain access to an intranet!

jcage@lycos.com

2007-04-29, 9:57 pm

I've looked at this, experimented and am . On form 1, the
pull down box $to variable passes data to form 2 just fine.

On form 1, I'm using joe & bob only and that info does come through
fine. On form two, I tried;

$arrEmailAddresses = array( 'joe'=>'joe@server.com',
'bob'=>'bob@server.com' ):
array_keys($arrEmailAddresses);

and leaving my TO line on the mailer portion alone:
$mail->AddAddress($to);

and get the following error message:
Mailer Error: Language string failed to load: recipients_failedjoe

I sense that I'm missing a big part of the array keys indexing but am
not sure. Somehow, the email address loaded into the array isn't
getting to the mailer portion of $to



On Apr 22, 3:49 am, shimmyshack <matt.fa...@gmail.com> wrote:

> as you do not need to send the email addresses from the browser to the
> server in order for the server to use the value - which sent the
> emails to the browser in the first place - why not have an array in
> your logic, $arrEmailAddresses = array( 'joe'=>'...@server.com',
> 'bob'=>'...@server.com' ); and simply have values joe and bob... in
> your webpage and use the posted value - provided it exists in the
> array obtianed by array_keys($arrEmailAddresses) as the index you then
> uuse to obtain the email.



Timbo Twiddly

2007-04-29, 9:57 pm

Make sure you have proper path to the language file.

$mail->SetLanguage("en","phpmailer/language");

<jcage@lycos.com> wrote in message
news:1177864368.543279.287540@u30g2000hsc.googlegroups.com...
> I've looked at this, experimented and am . On form 1, the
> pull down box $to variable passes data to form 2 just fine.
>
> On form 1, I'm using joe & bob only and that info does come through
> fine. On form two, I tried;
>
> $arrEmailAddresses = array( 'joe'=>'joe@server.com',
> 'bob'=>'bob@server.com' ):
> array_keys($arrEmailAddresses);
>
> and leaving my TO line on the mailer portion alone:
> $mail->AddAddress($to);
>
> and get the following error message:
> Mailer Error: Language string failed to load: recipients_failedjoe
>
> I sense that I'm missing a big part of the array keys indexing but am
> not sure. Somehow, the email address loaded into the array isn't
> getting to the mailer portion of $to
>
>
>
> On Apr 22, 3:49 am, shimmyshack <matt.fa...@gmail.com> wrote:
>
>
>



Captain Paralytic

2007-04-30, 8:03 am

On 29 Apr, 17:32, j...@lycos.com wrote:
> I've looked at this, experimented and am . On form 1, the
> pull down box $to variable passes data to form 2 just fine.
>
> On form 1, I'm using joe & bob only and that info does come through
> fine. On form two, I tried;
>
> $arrEmailAddresses = array( 'joe'=>'...@server.com',
> 'bob'=>'...@server.com' ):
> array_keys($arrEmailAddresses);
>
> and leaving my TO line on the mailer portion alone:
> $mail->AddAddress($to);
>
> and get the following error message:
> Mailer Error: Language string failed to load: recipients_failedjoe
>
> I sense that I'm missing a big part of the array keys indexing but am
> not sure. Somehow, the email address loaded into the array isn't
> getting to the mailer portion of $to
>
> On Apr 22, 3:49 am, shimmyshack <matt.fa...@gmail.com> wrote:
>
>
>
>
> - Show quoted text -


What is the line:
array_keys($arrEmailAddresses);
supposed to accomplish?

Captain Paralytic

2007-04-30, 8:03 am

On 29 Apr, 17:32, j...@lycos.com wrote:
> I've looked at this, experimented and am . On form 1, the
> pull down box $to variable passes data to form 2 just fine.
>
> On form 1, I'm using joe & bob only and that info does come through
> fine. On form two, I tried;
>
> $arrEmailAddresses = array( 'joe'=>'...@server.com',
> 'bob'=>'...@server.com' ):
> array_keys($arrEmailAddresses);
>
> and leaving my TO line on the mailer portion alone:
> $mail->AddAddress($to);
>
> and get the following error message:
> Mailer Error: Language string failed to load: recipients_failedjoe
>
> I sense that I'm missing a big part of the array keys indexing but am
> not sure. Somehow, the email address loaded into the array isn't
> getting to the mailer portion of $to
>
> On Apr 22, 3:49 am, shimmyshack <matt.fa...@gmail.com> wrote:
>
>
>
>
> - Show quoted text -


When I first wanted to do somethng like this I used phpformmail from
http://www.boaddrink.com/projects/phpformmail/
That shows you how to get the to: list built and looking through it
will give yo a lot of other hints.

cover

2007-04-30, 6:58 pm

On 29 Apr 2007 09:32:48 -0700, jcage@lycos.com wrote:

So the form works fine with form 1 passing to the acknowledgement form
(form 2) but somehow, I need to pick from the array, the email
addresses associated with 'joe' and 'bob' and insert those values in
the mailto line of the phpmailer script that's part of form 2.

$arrEmailAddresses = array( 'joe'=>'joe@server.com',
'bob'=>'bob@server.com' );

so the question, how can I grab only the email address from
$arrEmailAddresses array above for replacement of the $to in the line
below?

$mail->AddAddress($to);

ie: replace as follows: "if joe, then use joe@serverlcom from array"
$mail->AddAddress($arrEmailAddresses);

thanks,
John
Captain Paralytic

2007-04-30, 6:58 pm

On 30 Apr, 14:20, cover <coverlandNOSPAM...@yahoo.com> wrote:
> On 29 Apr 2007 09:32:48 -0700, j...@lycos.com wrote:
>
> So the form works fine with form 1 passing to the acknowledgement form
> (form 2) but somehow, I need to pick from the array, the email
> addresses associated with 'joe' and 'bob' and insert those values in
> the mailto line of the phpmailer script that's part of form 2.
>
> $arrEmailAddresses = array( 'joe'=>'...@server.com',
> 'bob'=>'...@server.com' );
>
> so the question, how can I grab only the email address from
> $arrEmailAddresses array above for replacement of the $to in the line
> below?
>
> $mail->AddAddress($to);
>
> ie: replace as follows: "if joe, then use joe@serverlcom from array"
> $mail->AddAddress($arrEmailAddresses);
>
> thanks,
> John


As I already said, go and get phpformmail from http://www.boaddrink.com/projects/phpformmail/
It not only shows you how to do this but a lot more besides!

$mail->AddAddress($arrEmailAddresses[$to]);

jcage@lycos.com

2007-05-02, 9:57 pm

This is pretty weird... I have only 'joe' and 'bob' on my first form
pull down and they pass the name just fine through my $to variable to
the 2nd acknowledgment form. The array below works fine as verified
by using a print command on the array but for whatever reason, using
$mail->AddAddress($arrEmailAddresses[$to]); as part of the form mailer
returns an error where if I substitute $to (with an actual address
from the first page, the mailer works fine and mails the message.

code is as follows:
$arrEmailAddresses = array( 'joe'=>'...@server.com',
'bob'=>'...@server.com' );
print_r($arrEmailAddresses[$to]);

the above code returns the proper email to the screen but when used
below, gives me back an error.

$mail->AddAddress($arrEmailAddresses[$to]);

can someone tell me what's up with that?

thanks VERY much... :-)

Captain Paralytic

2007-05-03, 6:57 pm

On 3 May, 02:36, j...@lycos.com wrote:
> This is pretty weird... I have only 'joe' and 'bob' on my first form
> pull down and they pass the name just fine through my $to variable to
> the 2nd acknowledgment form. The array below works fine as verified
> by using a print command on the array but for whatever reason, using
> $mail->AddAddress($arrEmailAddresses[$to]); as part of the form mailer
> returns an error where if I substitute $to (with an actual address
> from the first page, the mailer works fine and mails the message.
>
> code is as follows:
> $arrEmailAddresses = array( 'joe'=>'...@server.com',
> 'bob'=>'...@server.com' );
> print_r($arrEmailAddresses[$to]);
>
> the above code returns the proper email to the screen but when used
> below, gives me back an error.
>
> $mail->AddAddress($arrEmailAddresses[$to]);
>
> can someone tell me what's up with that?
>
> thanks VERY much... :-)


| the above code returns the proper email to the screen but when used
| below, gives me back an error.
|
| $mail->AddAddress($arrEmailAddresses[$to]);
|
| can someone tell me what's up with that?

Think about it! What have't you told us that you really should have?

Let me give you a clue: "gives me back an error."

WHAT ERROR?????!!!!!!

How are we supposed to help you when you don't tell us? We don't have
a crystal ball.

jcage@lycos.com

2007-05-03, 6:57 pm

On May 3, 7:28 am, Captain Paralytic <paul_laut...@yahoo.com> wrote:

> WHAT ERROR?????!!!!!!


Sorry about that.

"data_not_accepted" when using: $mail-
>AddAddress($arrEmailAddresses[$to]);

and
"provide_address" when using $mail->AddAddress =
($arrEmailAddresses[$to]);

with either of the above syntax, the correct address from the array IS
returned to the screen with the print command shown below.

$arrEmailAddresses = array( 'joe'=>'...@server.com',
'bob'=>'...@server.com' );
print_r($arrEmailAddresses[$to]);

i.e.
joe@gmail.com prints to the page just fine, just isn't working
properly in the "AddAddress" line.

Captain Paralytic

2007-05-04, 7:58 am

On 3 May, 20:36, j...@lycos.com wrote:
> On May 3, 7:28 am, Captain Paralytic <paul_laut...@yahoo.com> wrote:
>
>
> Sorry about that.
>
> "data_not_accepted" when using: $mail->AddAddress($arrEmailAddresses[$to]);
>
> and
> "provide_address" when using $mail->AddAddress =
> ($arrEmailAddresses[$to]);
>
> with either of the above syntax, the correct address from the array IS
> returned to the screen with the print command shown below.
>
> $arrEmailAddresses = array( 'joe'=>'...@server.com',
> 'bob'=>'...@server.com' );
> print_r($arrEmailAddresses[$to]);
>
> i.e.
> j...@gmail.com prints to the page just fine, just isn't working
> properly in the "AddAddress" line.


You are trying to treat AddAddress as a method in one call and as a
property in another? Which is it? If it is (as I suspect) a method, I
would put some trace statements in it (the method) to see what is
giving the error. I seem to recall you saying that you managed the
call successfully when hard coding an address, so look at the trace in
both cases (hard coded/array) and you will see what the difference is.

Finally, once again, why not use the method that I suggested a few
days ago.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com