Forum Moderators: coopster

Message Too Old, No Replies

php mail() help

new to php - mail won't work

         

crop

4:13 pm on Nov 15, 2004 (gmt 0)

10+ Year Member



Hello

I'm new to php and I'm now using it because I got to do a flash site with a form that collects variables and sends them to an php script that organize and e-mail the input.
When testing it in my server, everything went fine, but, when changing to another server it all collapse as no e-mail gets to me.

I called the company that runs the server, and I know that they run it on an Apache 2.0 with Linux redhat, and have PHP 4.2 installed.
I've runed the php.info on their server and got data but I don't know how to use it to solve this.
I've tried forums, and they asked me to try and send a simple e-mail

<?php
mail("mymail@anotherserver.com","Teste","testing");
?>

and it failed.
Could anyone please help me. I need to know where is the problem, and if I can configure a php script in order to send e-mails from this server. What do I need to ask the server company and where do I place the info in the script in order for it to work.

Thanks in advance.

Crop

crop

4:37 pm on Nov 15, 2004 (gmt 0)

10+ Year Member



Please help...

If anyone knows a topic where this subject as been discussed, please tell me.
I'm already on page 11 of PHP topic and looking.

Thanks,

Crop

coopster

9:28 pm on Nov 15, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, crop.

Have you checked out the WebmasterWorld PHP Forum Library [webmasterworld.com]? There you can find the Basics of Submitting and Emailing Forms with PHP [webmasterworld.com].

crop

9:37 pm on Nov 15, 2004 (gmt 0)

10+ Year Member



hi and thanks

I will try the code right now.
I'm not to sure, though, as the problems seems to be in the mail function.

I'll let you know.

Thanks

Crop

crop

10:07 pm on Nov 15, 2004 (gmt 0)

10+ Year Member



Hi

I've tryed the example you gave me and, on my testing server it all went fine. On the final server, all I got was the error message defined:

email could not be sent.

If this is a server problem, is there any way I can go around mail() to send e-mails that will hold, such as the example, variables from flash.

If so, please, please help (Perl/CGI and ASP are out of the question).

Thanks

coopster

10:21 pm on Nov 15, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Well, you got that message because the mail() function is failing. That's what the simple mail test in the first message stated as well. You'll have to start troubleshooting the server configuration.

crop

10:42 am on Nov 16, 2004 (gmt 0)

10+ Year Member



It must be something like that. I feel I've tried everything I could.
When you say troubleshooting the server configuration what do you mean? I have run phpinfo() - is this the starting point? Is there any way to configure the mail using other directories or names or something? If I call the hosting, what should I ask them.

I've just had an e-mail sent. I can't believe it.

I have a theory about this, since it was sent but it was sent from within the server to an e-mail located in the same server. I figure this server doesn't allow (or isn't configured to) sending mails to outside servers e-mails. Is this possible? In a future situation, is there a way to override it?

Thanks for the help

coopster

1:39 pm on Nov 16, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Well, now you know it works. And now the real fun begins. As jatar_k said in the thread link shown earlier, mail is a pain. The configuration of each and every server is unique. Some block certain headers, etc. just as you suspect. It is more than likely true. In the thread mentioned, have a look at the headers used and see if they will work for you.