Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
in Q2A Core by
edited by

Hello! smiley

I am having trouble understanding how to set up basic email usage.  (I'm not exactly a newbie, but it's been a decade since I've really touched webdesign, so I actually am a re-newbie I guess!)  I am having trouble getting info from my web-host, but I can answer most questions via info from the web-host's control panel/FAQ and phpinfo() or whatnot.


Settings on Q2A:
Administration center - Emails

Sender address for messages from site:  no-reply@mysite.com
Email address for admin messages - not shown to users:  xyz@hotmail.com
[_] Email this address when a question is posted
[X] Provide a page for users to send feedback
Privacy note for email addresses - HTML allowed:  (default text message)
[_]Send email via SMTP instead of local mail


I'm using PHP 5.3.13 (php-cgi).

From phpinfo(), I can tell you:

Directive Local Value Master Value
PHP Core - from phpinfo()
sendmail_from me@localhost.com me@localhost.com
sendmail_path /usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i
SMTP localhost localhost
smtp_port 25 25


Q2A is installed at: www.mysite.com/abc/xyz/<question2answer-latest/index.php> if that matters.


From WebHost:

Server Type: POP3

Incoming server name (POP3): mail.mysite.com
Incoming server port: 110

Outgoing server name (SMTP): mail.mysite.com
Outgoing server port: 25
Outgoing server authentication: required (type: SMTP-AUTH / Password)

Username: user@mysite.com
Password: (known)


I've also tried running a basic php mail() file like:

// The message
$message = "Line 1\r\nLine 2\r\nLine 3";

// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70, "\r\n");

// Send
mail('xyz@hotmail.com', 'My Subject', $message);


And in any case, whether it's the confirmation email a new member should be sent, me as ADMIN trying to test the "mass_email portion" of the Q2A site by having it send me a test email, or this mail() PHP command that I've provided above, which was copied directly from the PHP help for the "mail()" function page, I get no "apparent" errors and yet I never receive the email at the expected email address (xyz@hotmail.com or whatever the new member's email addy was that I tried for a test.)

I think I've provided enough information, and will provide whatever else is necessary upon request, that someone could help me.  I'll try whatever you think is best to try to troubleshoot the problem.  My web-host is not very helpful in providing such information, so perhaps someone would be willing to talk me through my ignorance towards this matter.  I would be quite grateful to get such assistance!


Thanks in advance!
Me smiley


(BTW: Yes, I'm sitting here refreshing the window semi-daily, waiting for anyone that might be kind enough to even TRY to help me!)

Q2A version: 1.7.3

1 Answer

+1 vote
selected by
Best answer
You have SMTP details from your host, so you should use those. Tick the "Send via SMTP..." option on the Admin > Emails page, and fill in the details that you see.
I looked up the errors given when I use SMTP:

which were:
 require() in index.php:27
 require() in qa-index.php:183
 qa_get_request_content() in qa-page.php:824
 require() in qa-page.php:203
 qa_send_new_confirm() in confirm.php:50

Or individually:
require() in index.php:27 - [index.php, line 27] : require 'qa-include/qa-index.php'; (So, the problem seems to be in the "required" file and is therefore found in the next error...)

require() in qa-index.php:183  - [qa-include/qa-index.php, line 183] : require QA_INCLUDE_DIR.'qa-page.php'; (Which is again, a problem found in the mentioned 'include', so the source of the error is likely found in the next error...)

qa_get_request_content() in qa-page.php:824  - [qa-include/qa-page.php, line 824] : $qa_content = qa_get_request_content(); (which seems to be the source of the problem, in part, either directly or indirectly - and it's obviously related to the next error via "$qa_content")

require() in qa-page.php:203  - [qa-include/qa-page.php, line 203] : $qa_content = require QA_INCLUDE_DIR.$routing[$requestlower]; (which seems to be another error related through "$qa_content" to the previous error and/or in the "required" file, listed next...)

qa_send_new_confirm() in confirm.php:50  - [qa-include/pages/confirm.php, line 50] : qa_send_new_confirm($loginuserid);  (And since the previous 'include' may have been "requiring" this file, since it IS in the QA_INCLUDE_DIR, or "qa-include" directory, it seems possible, despite what else I can figure out from the associated code, that this is the reason for the errors, and by that I mean that it is likely helpful in figuring out/troubleshooting my overall problem.)

I realize I've provided no 'context', only single statements, but I'm hoping you might have enough familiarity with the code to prevent me needing to throw 10x as much php-code into my comment!  I just thought it might save you some time if I did some more of the 'grunt work', so to speak!

And to be clear, these errors have presented themselves ONLY since I've changed to SMTP as you requested I do.
> Shouldn't the normal local mail work anyway? I would expect it to work if STMP would work

No I don't think so. mail() sends email using the server's sendmail program, while SMTP uses another server. SMTP is far more reliable because that other server is likely to be trusted, whereas your web server isn't and could be seen as spam.

> I now get the following errors

The most likely culprit is incorrect SMTP details, maybe the port or security type.

If you can't find a configuration that works, one possible problem could be the PHPMailer library. It was upgraded in 1.7.3 and someone else experienced problems. You could try downgrading to 5.2.13. Get it from https://github.com/PHPMailer/PHPMailer/releases, extract the files and overwrite the ones in qa-include/vendor/PHPMailer.
edited by
Thank you kindly for your response, Scott!

First, for what it's worth, Qmail is being used by by web-host, which they say is an exact "drop-in" replacement for sendmail.  

I did exactly what you recommended (replacing the PHPMailer lib with 5.2.13), and I did so correctly, yet no change was observed, whatsoever.  I am sorry to be such a frustrating case!    

I also tried installing the full PHPMailer lib install in a seperate directory and use some of their included "example" files for SMTP w/auth and some of the more basic ones just to give anything a chance...all seemed to function correctly (from the output provided) but I never received the email at the intended location!

Using "webmail" included with my web-host (NuralStorm), I immediately get satisfaction in the form of email that arrives at the desired location.

I have tried to pose the question to my web-host, and they say they don't know the details of third party software, ergo it is my tough luck (not in so many words of course!)  

I've examined my php.ini file over-and-over to be sure there is nothing in there that might be causing the problem to no avail.

I am running out of hair to pull out, though I truly appreciate your time and tedious work on this project (Q2A)!  I've been working for 2-3 days straight and I'm really quite sure that it has to be either the information that I'm supplying that is incorrect or an issue caused by my web-host.... I've re-poked them, and the best that I finally get back ts to try a different "to" recipient web-email addy, which I tried...changing from Hotmail to Gmail and then AOL...zero difference.  I'll be lucky to hear back from them in a week or two, now.
Just to follow through, in the interest of the community,  I tried changing the "to" email attribute to an email addy on a completely different server (GMail to be specific!)  And, while it seemed to cause the same result at first, upon closer examination of my spam folder, FOR THE LOVE OF GOD (says the atheist), I found the intended messages!  It turns out that despite the fact that I've not used my email on that web-host for years, and really not even used that web-host for years at all (despite the fact that I pay for it) that someone or perhaps some malware SOMEHOW (still seemingly impossible to me) hijacked my mail server...despite their claims of it being uber-secure, and several months ago, at least, has used it to mass-mail some crazy *.ti or *.it email addys, in the magnitude of 3200 emails on 1-24-2016 at last try!   So I presume I was blacklisted, and Hotmail didn't even so much as accept the emails, but GMail at least accepted them, though placed them in the spam folder.  So I now have changed my p/w's, as strong as they were, for my mail server, and have my webhost (finally) working on acquiring a new IP addy for the mail server!  So, if you should have a similar problem check your sent mail and returned mail on said server to be sure that someone/something has not hijacked your mail-server and bombarded the bejesus out of anyone/everyone with mass-mailings!   

Oh, and change your p/w, and assuming your don't listen to 'common p/w reasoning', change any other place that you've duplicated that same p/w, which of course no one does,... Right?!  LOL!

Thanks again for your apparently endless assistance, Scott!  I don't know how you do it, but once I have become intimately familiarized with the software, I will not forget to return the favor by helping others, here!