error message for guestbook

Dr. GBooky is here to help you with your guestbook problems ...
Nancy

New message

Post by Nancy »

OK, I made the change and this is what I got when I tried it.


Warning: mail() [function.mail]: SMTP server response: 501 5.5.4 Invalid Address in C:\Inetpub\wwwroot\pughcachets.com\www\gbook\gbook.php on line 466


Now what??? Any ideas?
Nancy

Don't understand

Post by Nancy »

I'm sorry, I don't mean to sound dumb, but I don't understand what I am supposed to do. I am trying to get this guestbook setup for someone else's website, so the email will be going to them, not me. The website is on an individual's server, so I am at their mercy to get settings, etc. done that need to be changed on the server for this to work properly.
I am just about to give up on this even though I love the way the guestbook is supposed to work.
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Post by Henrie »

I looked around at the internet and it seems that some smtp servers with iis do not support a "to name" so you can send it to an email but not along with a name. So try changing line 466 to:

Code: Select all

mail("$settings[admin_email]","Someone has just signed your guestbook",$message,"From: $email");
or:

Code: Select all

mail("$settings[admin_email]","Someone has just signed your guestbook",$message,"From: name@website.com");
Where the e-mail address (name@website.com) could be something like gbook@pughcachets.com . This method is more likely to work because in the first code an e-mail address must be filled in by the submitter of the message otherwise you get an empty "from" header and this could be not accepted by the mail server.

If this does not work:
  1. Do you know if the mail function of the server on which the other persons website is placed is properly set up? Can you sent e-mail at all from this server (for example with a mail form)?
  2. Ask the owner of the server that hosts the website what settings you have to use (or can not use) in a script to send mail via the server.
Greetings,
Henrie
Last edited by Henrie on Tue Oct 25, 2005 5:16 am, edited 1 time in total.
Nancy

Post by Nancy »

Hello Henrie,


Do I add the actual email address that it is going to into the code or just put it in the way you have it?

Thank you for your patience,
Nancy
Nancy

Success!

Post by Nancy »

Thank you Henrie! The second code worked wonderfully! So disregard my last question.
I really do appreciate all the time and trouble you went to to help me get this up and running.

Nancy
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Post by Henrie »

Glad I could help you.

For other readers who have the same problem an answer to your last question.
The "From" header shows the receiver of the e-mail where the e-mail came from.
This is normally a name with an e-mail address or just an e-mail addres.
This is not the e-mail address that it should be send to. In the code given this is set by $settings[admin_email] which is defined in the settings.php file.
The subject of the e-mail you receive is the second parameter and is now Someone has just signed your guestbook. So this could be changed if you would like to (keep the quotes "").

With the first code mail("$settings[admin_email]","Someone has just signed your guestbook",$message,"From: $name <$email>\r\n"); you would see the name of the submitter (taken from the script) with his e-mail address (when given).

With the second code mail("$settings[admin_email]","Someone has just signed your guestbook",$message,"From: $email"); just the e-mail address of the submitter would be shown. But as email is not a required field this value could als be empty which obviously is not permitted by all e-mail servers.

With the third code mail("$settings[admin_email]","Someone has just signed your guestbook",$message,"From: name@website.com"); the e-mail is allways send with the same "from" header. So you should change name@website.com to a more descriptive address like gbook@mywebsite.com

Henrie.
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

Henrie wrote:I looked around at the internet and it seems that some smtp servers with iis do not support a "to name" so you can send it to an email but not along with a name.
That's a good thing to know, thanks!
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Post by Henrie »

Hello Klemen,

I found the message here http://forum.mamboserver.com/showthread ... 533&page=2
The message was:
php4.3 Apache2.0.43 IIS SMTP server

the smtp server with iis5 does not support a TO NAME,
you can send it to an email but not along with a name.
to say $to = "Miki <Miki@email.com>"; would not be accepted and you will get an error 501 Invalid address.
if you see this error, just try NOT sending emails with a TO name, only the email should be entered
Greetings Henrie
Post Reply