Page 1 of 1
PHP and Email
Posted: Sun Jan 13, 2008 4:41 pm
by wonkavator
Hi,
I really know nothing about PHP, so please bear with me.
I installed a script that was written in PHP and it has a function that will send an email to the user after they have posted some information. All of the script reflects the domain that it is installed on, PHP safe mode is off, yet I still get a response from the script that the email can not be sent.
Everyone else that has used the script does not experience the same problem.
I really dont understand how PHP can send emails directly or anything of that nature.
In your opinions what could cause an email to not be sent when using PHP to send emails? Are there some common things to look for. The script has been installed on a webhost that uses cPanel.
any help or direction would be greatly appreciated.
Kind regards.
Re: PHP and Email
Posted: Sun Jan 13, 2008 5:31 pm
by alex.barylski
Could be any number of things...
The most obvious (although not likely as it's so obvious) is to make sure your host has an SMTP server. Secondly make sure your SMTP details are correct.
Other than that, without going intot he code and stepping through it's execution...I would suggest switching hosts and/or asking the original developer what they think as they are best suited to answer such a question.
Re: PHP and Email
Posted: Sun Jan 13, 2008 5:41 pm
by wonkavator
Thank you Hockey, I appreciate your suggestions.
Is there an easy way to look and step through the execution of code to see what actually happens?
Re: PHP and Email
Posted: Sun Jan 13, 2008 6:25 pm
by alex.barylski
Perhaps using a integrated debugger, maybe something like Eclipse. Personally I don't find it nessecary in PHP so I just manually step through code with 'echo' statements on lines that leave me asking questions...
If you are not familiar with PHP I imagine you will find it difficult to step through the code and figure out what is going wrong.
What script are you using, just curious? Perhaps some here has experienced the same issue.
Re: PHP and Email
Posted: Sun Jan 13, 2008 6:50 pm
by wonkavator
The script that i am using is called xeroclassifieds found at xzeroclassifieds.com
Re: PHP and Email
Posted: Sun Jan 13, 2008 6:58 pm
by jimthunderbird
Have you tried PHP Mailer
http://phpmailer.codeworxtech.com/ ?
It's a good php mailing component.
But one trick is the port number of smtp might not be always 25, I known some hosting companies (for example: hostmonster) set it to 26.
-- Jim
Re: PHP and Email
Posted: Sun Jan 13, 2008 7:01 pm
by wonkavator
Thank you.
I will give that a look.
I must say that this forum has some nice people willing to help out someone that knows hardly anything.
I appreciate it.

Re: PHP and Email
Posted: Mon Jan 14, 2008 9:48 am
by Jonah Bron
BTW.
If you are wondering how php send mail, it's with the mail function, or swift mailer
Code: Select all
mail('recipient', 'message subject', 'message', [headers]);
Re: PHP and Email
Posted: Mon Jan 14, 2008 9:58 am
by wonkavator
That helps me. Thank you PHPYoungster.
I also looked at PHP Mailer that was suggested by JimThunderbird. PHP Mailer seems good from what I could understand, unfortunately, since I didnt write the original script I would not know how to implement it in the script that I am using.