PHP and Email

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
wonkavator
Forum Newbie
Posts: 5
Joined: Sun Jan 13, 2008 4:34 pm

PHP and Email

Post 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.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: PHP and Email

Post 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.
wonkavator
Forum Newbie
Posts: 5
Joined: Sun Jan 13, 2008 4:34 pm

Re: PHP and Email

Post 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?
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: PHP and Email

Post 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.
wonkavator
Forum Newbie
Posts: 5
Joined: Sun Jan 13, 2008 4:34 pm

Re: PHP and Email

Post by wonkavator »

The script that i am using is called xeroclassifieds found at xzeroclassifieds.com
User avatar
jimthunderbird
Forum Contributor
Posts: 147
Joined: Tue Jul 04, 2006 3:59 am
Location: San Francisco, CA

Re: PHP and Email

Post 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
wonkavator
Forum Newbie
Posts: 5
Joined: Sun Jan 13, 2008 4:34 pm

Re: PHP and Email

Post 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. :D
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: PHP and Email

Post 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]);
wonkavator
Forum Newbie
Posts: 5
Joined: Sun Jan 13, 2008 4:34 pm

Re: PHP and Email

Post 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.
Post Reply