The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Failed to send email (admin if sent)
#11
Thanks! So back to forgot_password.php and verify_resend.php

Seems like fail is due to rawurlencode(), don't know enough about that function but will begin reading up on it!

$encoded_email=rawurlencode($email); // Error: "Email NOT sent due to error. Please contact site administrator."
$encoded_email=$email; // Works but probably unsafe?
  Reply
#12
Seems like the urlencode issues was addressed in this post...

https://www.userspice.org/forums/topic/email-problem-2/
  Reply
#13
I'll take a look at it. There was a little debate when I first made this fix. I'll take a crack at it now.
  Reply
#14
This fix looks to be in place for 4.2.10 however, I'm getting the "Email NOT sent due to error. Please contact site administrator." error when using the forgot_password.php page.

I see no errors in my apache log, and no connection errors or anything in the postfix logs on the email server. So it looks like PHP isn't even getting to the point of contacting the email server to send the message. I've set the SMTP information under Email Settings to use my email address (by IP), TLS transport, with username and pass. I've verified the user/pass combo is good by logging into the server through an email client. Again, I don't even see a connection attempt at the email server so I believe something is happening on the webserver. Are there any PHP package pre-reqs on Ubuntu 14.04 that I should be looking for? Any apache mods that need to be enabled? It's going to be some small detail I'm missing... I see it's using PHPMailer, and I'm unfamiliar with that class. It has places for SMTP variables, but those are pulled from the email table in the db when the class is called to send an email, right?
  Reply
#15
Did you test the settings using email_test.php?
  Reply
#16
Yes, it results in:

Mail ERROR
  Reply
#17
Ok, apparently I don't read so well... Smile

I uncommented line 136 in users/helpers/helpers.php:

$mail->SMTPDebug = 3; // Enable verbose debug output

and that gave me a "failed to instatiate mail function" error on the test page. So that made me think about sendmail vs smtp, which lead me to:

line 138 in users/helpers/helpers.php:

//$mail->isSMTP(); // Set mailer to use SMTP

and uncommented that line, and now email works.

So a small suggestion:

Perhaps "Use sendmail/Use SMTP" should be a drop-down select in Email settings so it's obvious to the UserSpice admin and pulled from the DB, without changing code.
  Reply
#18
We were trying to see when this would break SOMEONES project!

We commented this out due to known issues with Gmail and other providers - but we haven't had any complaints of issues.

@mudmin

We could do this easily with an if value in the modification class - eh?

Thoughts?
  Reply
#19
My suggestion would be to store a database value in the email table of sendmail or smtp, and provide a drop-down select menu. The default could be sendmail, and if you select SMTP, then the other fields appear from a hidden
Code:
<div>
.

Then you could simply query the db for the value, and send that with the function values so line 121:

Code:
function email($to,$subject,$body,$attachment=false){

could change to:

Code:
function email($to,$subject,$body,$attachment=false,$mta){

then you could do this around line 138:

<pre>
Code:
if ($mta == "smtp") {
  $mail->isSMTP();
}
</pre>


This way it's user friendly for those admins that know no code.

I can see why you wouldn't have that may complaints though because a lot of hosting providers keep sendmail() on their hosting servers (like GoDaddy) where you wouldn't need SMTP. I uninstall sendmail from my hosting servers and force admins to use SMTP through their email via postfix so I can see when I might have a runaway spam site, and I can easily disable the violating email account to stop the email.

Sorry, I just saw where you asked @mudmin specifically on this. But hope the input helps!
  Reply
#20
This information is great @corey - Thank you - we will figure out what is best (I'm thinking your suggestion) and deploy it shortly - probably US 4.3 or 5 depending on Mudmin's plans
  Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)