MyBB Community Forums

Full Version: Can't get PHP mail to work
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
New install of MyBB 1.6.11 on DreamHost
link to forum

I've tried everything I can think of and have tried to find the answer but haven't had much luck.

Here's a copy of what I've sent to the host to try to get the mail working, and it highlights the problem I am having with the board.

I haven't heard back from DreamHost yet, but was hoping I could get some insight here.

Thanks.

................................
Copy of support request to DreamHost
.........................................
I have set up a small forum, and can't get the email function to work. The program is MyBB (the same as the forum software here on DreamHost)
The problems I have noticed are as follows.

.............................

1. There is no authentication email sent to new users. (php mail)

2. Users can't send emails to other users. (php mail)

3. I CAN send email from the admin CP, (because it sends via my computer's SMTP mail)

4. The "Contact Us" link sends email (again SMTP mail)

...................................

I have uploaded and run a PHP mail function "test script" and got the message "Mail was sent by PHP" and there were no other errors.

Does DreamHost have restrictions on PHP mail from a BB program?

If so, how can I configure things to get this to work?
Here's the response from DreamHost (my bolding)

I'm happy to assist you. I checked the logs for your forum on your site
and did see that the emails are being bounced by the server due to our
anti spam policies which won't allow email sent from the server using
non-Dreamhost outgoing servers or "send from" email addresses. You can
read more details on this policy here;

http://wiki.dreamhost.com/Sender_Domain_...d_Spoofing

Your mail form uses the visitor's email address as the 'From' address
which in most cases is not a Dreamhost hosted email address. Due to the
spam policy above, the server will block mail being sent off the server
if the email addresses are not using Dreamhost mail servers. So what you
will need to do is either set the mail form to use your Dreamhost hosted
address as the 'From' address.

Or you will need to find another mail form that will allow you to set a
fixed email address as the 'From' address. This way you can set a
Dreamhost hosted email address in the form as the 'From' address.



So I'm just getting more confused all the time.

Any help? Please?
You can try setting your outgoing mail to a email hosted with Dreamhost (same domain), if you haven't done so already. If that doesn't work, you can take a look at SMTP if they are bouncing back the emails from PHP Mail.

MyBB Setting should be ...
AdminCP --> Settings --> Mail Settings --> Change Mail Handler to SMTP.

and then input the changed settings from

DreamHost SMTP Options: https://discussion.dreamhost.com/thread-135399.html

Let us know if you need any additional information.
Well, I've tried everything and still can't get the emails to work through the board. Very frustrating! I just can't get Dreamhost and the board to play together nicely!

I can set the board to Admin Activation, so that email doesn't have to be sent, and I can live with that. The "Contact Us" link works at the bottom of the page, so that's OK.

I can email users from the Admin CP because it's my ISP mail that handles them (visible email links) It's just the user email to each other from the profiles that won't work. ... 2 more questions ...

#1 - is there any way to set it so the user's emails show up in their profile rather than "send user an email"?
That way, when the link is clicked, the computer's ISP mail fires up and sends the mail. Each user can hide their email from others in their profile settings if they want.

#2 - barring that is there some way to remove the "Send user an email" link entirely from the profiles?
That way, no one is trying to send emails that aren't going anywhere. I actually prefer this because it isn't that important for this board to allow users to email each other.
(2013-12-12, 01:51 AM)LorisA Wrote: [ -> ]Well, I've tried everything and still can't get the emails to work through the board. Very frustrating! I just can't get Dreamhost and the board to play together nicely!

I can set the board to Admin Activation, so that email doesn't have to be sent, and I can live with that. The "Contact Us" link works at the bottom of the page, so that's OK.

I can email users from the Admin CP because it's my ISP mail that handles them (visible email links) It's just the user email to each other from the profiles that won't work. ... 2 more questions ...

#1 - is there any way to set it so the user's emails show up in their profile rather than "send user an email"?
That way, when the link is clicked, the computer's ISP mail fires up and sends the mail. Each user can hide their email from others in their profile settings if they want.

#2 - barring that is there some way to remove the "Send user an email" link entirely from the profiles?
That way, no one is trying to send emails that aren't going anywhere. I actually prefer this because it isn't that important for this board to allow users to email each other.

Have you tried SMTP; if so can you provide details on how it didn't work?

There is absolutely no reason why Dreamhost should not provide SMTP access that is non-functional if they limit the use of PHP Mail.

-----

Sorry. I misread. I did not read that you have SMTP setup to the computer's ISP mail.

Is there a specific reason as to why you are not using DreamHost's SMTP servers for every email sent from MyBB?

As for the test script you ran, what email did you use for sending.
Try using that same email in the following steps:

Note: Quote from URL: http://docs.mybb.com/Help-Mail.html
Quote:It should say "Mail was sent by PHP" and there should not be any other errors that show up.

Some webhosts have various restrictions on PHP mail. Some hosts require that the "From" address be a mailbox address on their server. Other hosts may disable the mail function completely. Please ask your webhost if there are any special restrictions they have on sending mail via PHP.

If your webhost has restricted that only mails from there own domain is allowed, try to edit the file inc/functions.php. Look for:

mail($to, $subject, $message, $headers);
and include above: ini_set("sendmail_from", " [email protected] ");
Then it should look like this:

ini_set("sendmail_from", " [email protected] "); mail($to, $subject, $message, $headers);
YOURDOMAIN must be replaced by the domain where the forum is hosted.
(2013-12-12, 02:17 AM)Init Wrote: [ -> ]
(2013-12-12, 01:51 AM)LorisA Wrote: [ -> ]Well, I've tried everything and still can't get the emails to work through the board. Very frustrating! I just can't get Dreamhost and the board to play together nicely!

I can set the board to Admin Activation, so that email doesn't have to be sent, and I can live with that. The "Contact Us" link works at the bottom of the page, so that's OK.

I can email users from the Admin CP because it's my ISP mail that handles them (visible email links) It's just the user email to each other from the profiles that won't work. ... 2 more questions ...

#1 - is there any way to set it so the user's emails show up in their profile rather than "send user an email"?
That way, when the link is clicked, the computer's ISP mail fires up and sends the mail. Each user can hide their email from others in their profile settings if they want.

#2 - barring that is there some way to remove the "Send user an email" link entirely from the profiles?
That way, no one is trying to send emails that aren't going anywhere. I actually prefer this because it isn't that important for this board to allow users to email each other.

Have you tried SMTP; if so can you provide details on how it didn't work?

There is absolutely no reason why Dreamhost should not provide SMTP access that is non-functional if they limit the use of PHP Mail.

-----

Sorry. I misread. I did not read that you have SMTP setup to the computer's ISP mail.

Is there a specific reason as to why you are not using DreamHost's SMTP servers for every email sent from MyBB?

As for the test script you ran, what email did you use for sending.
Try using that same email in the following steps:

Note: Quote from URL: http://docs.mybb.com/Help-Mail.html
Quote:It should say "Mail was sent by PHP" and there should not be any other errors that show up.

Some webhosts have various restrictions on PHP mail. Some hosts require that the "From" address be a mailbox address on their server. Other hosts may disable the mail function completely. Please ask your webhost if there are any special restrictions they have on sending mail via PHP.

If your webhost has restricted that only mails from there own domain is allowed, try to edit the file inc/functions.php. Look for:

mail($to, $subject, $message, $headers);
and include above: ini_set("sendmail_from", " [email protected] ");
Then it should look like this:

ini_set("sendmail_from", " [email protected] "); mail($to, $subject, $message, $headers);
YOURDOMAIN must be replaced by the domain where the forum is hosted.

I'm not aware that I "have SMTP set up to the computer's ISP" as you said. It is simply that whenever I click on any email links that are "in the clear" my ISP mail picks it up and sends it. emails that Ive seen do this are the Contact Us link at the bottom of the forum, and the user emails as seen in the Admin CP. It was nothing I consciously did, but was that way out of the box, so to speak. These emails send with my computer's ISP mail even when I have nothing in the Board's SMTP settings at all and have PHP selected!
Sorry, but I seem to be out of my depth here.

As for your last question and suggestion, the email I used in the test script was [email protected]. I've tried to follow the steps outlined above, and in the docs, but I cannot find the string [b]mail($to, $subject, $message, $headers); anywhere in the inc/functions.php file[/b] to add the"ini set" code. I tried inserting the code in various places in the inf/functions.php file that resembled the string one is supposed to look for, and only succeeded in breaking the board! Blush
Again .. I'm out of my depth, and apologize for that, but it seems that the instructions for altering the functions.php code might be what dreamhost's support suggested I do, if I could find where to insert it!

Oh yeah .. in all of this there are NO error messages!

Just to confuse all of us even more, I tried to set the board to SMTP mail using the following info (dreamhost mailbox manager) to set up the board for SMTP
[Image: dreamhost.jpg]

Maybe I should delete the forum entirely and start over with a fresh install.
You have to set the SMTP settings from within the MyBB Admin Control Panel, have you done this already?

AdminCP --> Settings --> Mail Settings --> Change Mail Handler to SMTP.
and then change the according settings.

Quote:These emails send with my computer's ISP mail even when I have nothing in the Board's SMTP settings at all and have PHP selected!
Sorry, but I seem to be out of my depth here.

I'm not sure I understand. I'll need you to clarify what you mean by Computer's ISP? An ISP itself is most commonly defined as your Internet Service Provider, meaning the company you receive your internet connection through (other definitions may apply).

Let's start from scratch then. If your host does not allow PHP mail from a domain that is not your domain, you can either...

1. Set your outgoing email with MyBB Settings (yourdomain.com/admin/) **SEE BELOW** OR
2. Setup SMTP Settings within MyBB Settings (once again yourdomain.com/admin/)

**: If you want to setup outgoing email, I recommend you change the Admin Email to the same email you used in the test script ([email protected])
Go to the following setting: admin panel --> configuration --> settings --> general configuration --> Admin Email <-- enter correct mail

Note: In the Admin URLS provided, please replace yourdomain.com with your own domain (lorisart.org I assume)

You could try a fresh install, but it would only refresh the MyBB Settings, and not the host settings, or the fact that the host has a very uncommon way of handling PHP mail requests.

Let us know if you have any issues.
(2013-12-12, 04:53 AM)Init Wrote: [ -> ]You have to set the SMTP settings from within the MyBB Admin Control Panel, have you done this already?

Yes, with no luck

AdminCP --> Settings --> Mail Settings --> Change Mail Handler to SMTP.
and then change the according settings.

Quote:These emails send with my computer's ISP mail even when I have nothing in the Board's SMTP settings at all and have PHP selected!
Sorry, but I seem to be out of my depth here.

I'm not sure I understand. I'll need you to clarify what you mean by Computer's ISP? An ISP itself is most commonly defined as your Internet Service Provider, meaning the company you receive your internet connection through (other definitions may apply).

Probably the wrong wording on my part. What I meant by my computer's ISP mail was Outlook, installed on my computer, connected to my ISP.


Let's start from scratch then. If your host does not allow PHP mail from a domain that is not your domain, you can either...

1. Set your outgoing email with MyBB Settings (yourdomain.com/admin/) **SEE BELOW** OR
2. Setup SMTP Settings within MyBB Settings (once again yourdomain.com/admin/)

**: If you want to setup outgoing email, I recommend you change the Admin Email to the same email you used in the test script ([email protected])
Go to the following setting: admin panel --> configuration --> settings --> general configuration --> Admin Email <-- enter correct mail

Note: In the Admin URLS provided, please replace yourdomain.com with your own domain (lorisart.org I assume)

You could try a fresh install, but it would only refresh the MyBB Settings, and not the host settings, or the fact that the host has a very uncommon way of handling PHP mail requests.


I've done all that to the best of my knowledge.


Let us know if you have any issues.
If you have set up the correct SMTP settings and they are not sending; then I think it is time to consult your host and ask for their support. If they are not going to provide you with PHP Mail capabilities, then they should at least provide technical support for the installation or instructional use for SMTP utilization.

If worst comes to worst, come back here and I'll see what I can do manually with a test admin account (that is up to you though).

More Info: https://discussion.dreamhost.com/thread-...#pid170145