Click to See Complete Forum and Search --> : SMTP trouble


rapidz
01-08-2007, 11:03 AM
OK, i'm setting up a webform on someone elses server.

The form works perfectly on my server, however. The server i am testing on, does not allow relaying.

I get the following message...

Warning: mail() [function.mail]: SMTP server response: 550 <my@email.co.uk> is invalid. in D:\Domains\mywebsite.net\wwwroot\cerulean\mail.php on line 93


How do i get round this? Could someone please give me a step-by-step.

Many... MANY thanks in advance.

rapidz.

rapidz
01-08-2007, 11:11 AM
sorry i should have said.

What i want to be able to do, is only allow a certain email address to be able to send from the server.

is this possible?

rapidz
01-09-2007, 03:22 AM
???

NogDog
01-09-2007, 05:00 AM
I believe that means the "From:" email address being used to send the email is not recognized as a valid email address on your server.

rapidz
01-09-2007, 05:07 AM
yup, i believe your correct. but how do i allow my server to accept the "from:" email?

bathurst_guy
01-09-2007, 05:09 AM
Use a valid email.

NogDog
01-09-2007, 05:18 AM
You can use a valid email on that server for the "From:" value, but then set the "Reply-To:" value to whatever you would like it to be.

rapidz
01-09-2007, 05:45 AM
thankyou nogdog.

one more question, how would i code the reply to link?...

would it be like...


$reply = "myemail@email.com";

mail ($to,$subject,$body,$headers,$reply);

NogDog
01-09-2007, 05:57 AM
It would be added to your $headers string. It might look something like:

$headers = "From: valid_email@yourhost.com\r\n";
$headers .= "Reply-To: $reply\r\n";
$headers .= "X-Mailer: PHP/".phpversion();
// send it:
mail($to, $subject, $body, $headers);

rapidz
01-09-2007, 06:03 AM
nogdog. thankyou very much for your help.

just out of interest, what does the last line of headers do? what is x-mailer?

NogDog
01-09-2007, 06:21 AM
nogdog. thankyou very much for your help.

just out of interest, what does the last line of headers do? what is x-mailer?
Not really my area of expertise. The mail() web page (http://www.php.net/manual/en/function.mail.php) uses it in their example, so I do, too. :)

rapidz
01-09-2007, 06:39 AM
ok, it seems i'm now having trouble with some checkboxes.

if i don't tick a certain checkbox, the error message displayed is:

Notice: Undefined index: tick4 in D:\Domains\xs2data.net\wwwroot\cerulean\send.php on line 35

does anyone know what i'm doing wrong?

NogDog
01-09-2007, 01:49 PM
Checkbox element only appear in the $_POST or $_GET array if the box is checked, otherwise it's not set. Therefore, to avoid the notice, you need to refer to that element of the $_POST (or $_GET) array if it has actually been set:

$varname = (isset($_POST['tick4'])) ? $_POST['tick4'] : "";

(Change the "" at the end of that line to whatever value you'd prefer to use if the checkbox is not checked.)