kmoffitt;11033321 wrote:Still learning PHP; any thoughts on my error msg?
My thoughts are... the code would appear to work (though I haven't tried it myself), so we probably need to see more information to determine the cause of the error message (hence my suggestion to modify the SMTPDebug property).
kmoffitt;11033321 wrote:where is the TO: email address being picked up at?
The AddAddress() method should be building the To: header.
kmoffitt;11033321 wrote:my thoughts on the stripslashes was to remove in case the user for whatever reason added a \ from the form.
Okay, but that raises two more questions:
Why would you care if a backslash appears somewhere in the form?
If you didn't want any backslashes to appear, why are you using stripslashes()? Note that this:
$msg = 'This is a backslash: \\\\';
echo stripslashes( $msg );
will output this:
This is a backslash: \
(In other words, you're still allowing backslashes in the input - the user just has to escape them.)
kmoffitt;11033321 wrote:also the echo print at the bottom was just for me to view the value of that variable.
Right, but you are not echo'ing the value of that variable. What you are echo'ing is the value returned from the [man]print[/man] construct. Visit the manual page for this construct and you'll find this text:
PHP Manual wrote:Returns 1, always.
Thus, what you're telling PHP to do in a statement like this:
echo print $emailAddr;
is to print the value of the $emailAddr variable, and then echo the integer 1.
kmoffitt;11033321 wrote:Also, do I set the 'SMTPDebug' property to 2' in the php.ini file?
No, a property (see: [man]oop5.properties[/man]) is associated with an [man]object[/man], namely the one stored in $mail in this case. In other words, I'm asking you to add:
$mail->SMTPDebug = 2;
somewhere in your code (preferably close to the line where you instantiate the object so that we can get debug output started as early on in the process as possible).