View Full Version : Using Dreamweaver and PHP to send form results in an email

09-17-2010, 06:20 AM
Hi i'm new to php and need to know how and where to define the smtp server in this script i got from the tutorial http://www.dreamweaverclub.com/dreamweaver-php-form.php (http://www.dreamweaverclub.com/dreamweaver-php-form.php)

The script worked perfectly till my host moved the website to a different server where the host is no longer local.:roll: and now i get the error;

"Warning: mail() [function.mail]: SMTP Server response: 550 Requested action not taken: mailbox unavailable or not local in %hostedserverfilelocation% \phpfilname.php on line 39

So I think I need to define the smtp server... but how???

//--------------------------Set these paramaters--------------------------
// Subject of email sent to you.
$subject = 'Login Request';
// Your email address. This is where the form information will be sent.
$emailadd = 'myemail@mydomain.com.au';
// Where to redirect after form is processed.
$url = 'http://www.mydomain.com.au/confirmationlogin.html';
// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '0';
// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
foreach ($_POST as $key => $value)
if ($req == '1')
if ($value == '')
{echo "$key is empty";die;}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';

any help would really be appreciated!!!

09-17-2010, 07:30 AM
if you had it installed on a server where the script worked and the host moved the script to a new server then you need to contact them to get them to check their SMTP server config.

This is software which is configured by the host to handle outbound mail

09-19-2010, 11:37 PM
Thanks David, the new server doesn't have a smtp server installed locally. my host gave me the address of the smtp server I'm supposed to use but I don't know how to incorporate the address into my script.

09-20-2010, 02:34 AM
sounds like time to change hostinmg to me

09-20-2010, 06:49 AM
They need to configure their SMTP server to listen on localhost or provide instruction on how you should configure your script.

09-21-2010, 07:03 AM
Thanks for you help guys what needed to do is add the following to the script;

ini_set("sendmail_from","MyEmail (info@simcockit.com.au)Address");

before the mail() command