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
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$archive_pages - Line: 2 - File: printthread.php(287) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/printthread.php(287) : eval()'d code 2 errorHandler->error
/printthread.php 287 eval
/printthread.php 117 printthread_multipage



UserSpice
Failed to send email (admin if sent) - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23)
+--- Forum: UserSpice 4.3 and Below (https://userspice.com/forums/forumdisplay.php?fid=26)
+--- Thread: Failed to send email (admin if sent) (/showthread.php?tid=263)

Pages: 1 2


Failed to send email (admin if sent) - venedude - 10-15-2016

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?


Failed to send email (admin if sent) - venedude - 10-15-2016

Seems like the urlencode issues was addressed in this post...

https://www.userspice.org/forums/topic/email-problem-2/



Failed to send email (admin if sent) - mudmin - 10-16-2016

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.


Failed to send email (admin if sent) - corey_hitt@multiverse.software - 08-29-2017

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?


Failed to send email (admin if sent) - Brandin - 08-29-2017

Did you test the settings using email_test.php?


Failed to send email (admin if sent) - corey_hitt@multiverse.software - 08-30-2017

Yes, it results in:

Mail ERROR


Failed to send email (admin if sent) - corey_hitt@multiverse.software - 08-30-2017

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.


Failed to send email (admin if sent) - Brandin - 08-30-2017

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?


Failed to send email (admin if sent) - corey_hitt@multiverse.software - 08-30-2017

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!


Failed to send email (admin if sent) - Brandin - 08-30-2017

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