So new it hurts!

the mail() function

Moderators: macek, egami, gesf

jlavik
New php-forum User
New php-forum User
Posts: 2
Joined: Wed Mar 18, 2009 1:13 pm

So new it hurts!

Postby jlavik » Wed Mar 18, 2009 1:31 pm

I'm confused. I've got code that involves 6 files in all, much of it from a free script I got somewhere. The part that's failing (surprise surprise) is my own code, but it works beautifully on my own host site, where I was testing it. When I moved it to my client's host server, everything works except my attempt to send a followup email. I've narrowed it down to the user's email address. If I substitute an actual address for my variable, the whole process succeeds. Here's the relevant portion that isn't working on one server but succeeds on another (if you want it all, I'd be happy to provide it):

from a file called poll_vote.php:

Please enter your email address...
<form action="gift.php" method="post"
enctype="multipart/form-data">
<label for="addr">Email:</label> <br>
<input type="text" name="my_addr" id="my_addr"> <p>
<br />
<input type="submit" name="submit" value="Submit" />
</form>

and the file gift.php:
<?php
$to = $my_addr;
$subject = "Thank You for your feedback!";
$message = "Thank you for providing feedback. I sincerely appreciate every opinion.\r\n\r\nI'd like to take this opportunity to remind you that I am offering half-hour phone sessions at the special low rate of $25 for a limited time. Please email today to schedule your appointment.\r\n\r\nBest regards,\r\nMelannie";
$from = "melannie-insights@sbcglobal.net";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.<br>";
?>

Working example:
http://www.bwomdesign.com/melannie/contact.php

Failing example:
http://www.melannie-insights.com/contact.php

noxstyle
New php-forum User
New php-forum User
Posts: 1
Joined: Sun Jul 13, 2008 5:09 am

Re: So new it hurts!

Postby noxstyle » Sun Oct 25, 2009 2:44 am

Hello there,
Change

Code: Select all

$to = $my_addr;

to

Code: Select all

$to = $_REQUEST['my_addr'];


or do you assign the value for $my_addr in somewhere else?

jlavik
New php-forum User
New php-forum User
Posts: 2
Joined: Wed Mar 18, 2009 1:13 pm

Re: So new it hurts!

Postby jlavik » Sun Oct 25, 2009 3:05 am

Wow, you must be really bored if you're reading & replying to 7 month old posts. Thanks for the help, but I got it working a few days later.

Regards,
Judy


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 1 guest