cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PHP mail() not working

I have a HTML based form that is using a Php file to send the form information to my email.  The form is working and the "sent" message appears, however it never gets to my email.  The HTML and php files are in the same directory.It would be grateful if u help me solving this problem.

These was the information given by you..still its not working.

$host = "relay-hosting.secureserver.net";
    $port = "25";
$smtp = Mail::factory('smtp',
array ('host' => $host,'port' => $port,'auth' => false)); 

7 REPLIES 7
Anonymous
Not applicable

Re: PHP mail() not working

@prarambhan,

missing ')'

 

Re: PHP mail() not working

Exactly where?

Anonymous
Not applicable

Re: PHP mail() not working

Hi @prarambhan,

in the code you posted, and honestly if I have to tell you where...............?????

Re: PHP mail() not working

I really wonder how you people become trusted advisers! There are two open brackets and two close brackets! Where will the ending bracket (as advised by you) be in that code??

 

This a problem with the Godaddy server and not with the code! The code works fine but if you check the logs you will surely find the error! 🙂

 

I am not a PRO but I am a developer for more than 8 years now 🙂  

Anonymous
Not applicable

Re: PHP mail() not working

@suryashankarroy,

 


@suryashankarroy wrote:

I really wonder how you people become trusted advisers! There are two open brackets and two close brackets! Where will the ending bracket (as advised by you) be in that code??

 

This a problem with the Godaddy server and not with the code! The code works fine but if you check the logs you will surely find the error! 🙂

 

I am not a PRO but I am a developer for more than 8 years now 🙂  


 

 

i may have misread the code due to sloppy indentation, but that's no excuse to troll me and be so rude. If you were anything but a Wordpress designer you would know that one fundamental fact of being a developer is that you have to make mistakes and then go back and solve each one........

if you have never made a mistake then you don't qualify as a developer......

 

i know you are also having problems, but that is no excuse for rudeness. I won't waste any more time though. 

Re: PHP mail() not working

If you're still having trouble, try this:

 

I was able to solve my issue, so I'll share what I did. If you use the Office365 email account purchased with your domain, and you want the php in your code to send emails to that address via a form, then you have to make sure the MX entry on the domain server matches the MX entry in on the hosting server. Here's what you do:

 

1. Login to your GoDadday account, and click on "My Products"

2. Find your target domain and click on the "DNS" button

3. Scroll down until you see the entry row for "MX" and find the "Value" column

4. Copy this part of the entry to your clipboard. (should be some kind of web address)

5. Open a new tab and login to cpanel (...yourdomain/cpanel)

6. Scroll to the bottom to find the "Email" section. Click "MX Entry"

7. Make sure "Remote Mail Exchanger" radio button is selected. If not, select it and click change. (*** This is important before changing the MX entry***)

8. At the bottom,under "MX Records", click edit (or add a new one if it doesn't already exist).

9. Replace the "Destination" by pasting what you copied from the GoDaddy DNS manager.

10. Click "Edit". Now you're done.

 

The "MX record" should now match whatever was in the "Value" column of the MX entry from the DNS manager, and your form should work. I would imagine the same thing would work for any remote email server (e.g. Google), as long as the MX entries match. I hope this helps the rest of you who still can't get the email form on your site to work. 

Re: PHP mail() not working

@king_sarge could you please provide some more details on creating a new entry and what info to put in it, as one didn't already exist for me. Thanks!