[Logo] JForum - Powering Communities
  [Search] 搜尋   [Recent Topics] 最新主題   [Hottest Topics] 熱門主題   [Top Downloads] 熱門下載   [Groups] 回首頁 
[Register] 會員註冊 /  [Login] 登入 


JForum 2.8.3 is out with various fixes and improvements. Read all about it here

Problem with html in response emails RSS feed
討論區首頁 » User Forum
發表人 內容
jdev1


註冊時間: 2021/3/22
文章: 33
離線
Nope, now i testing with two users and they two have "Allow HTML" turned on.
Also if i change mail.messageFormat to text and change message template by removing html tags from it message comes with replaced line breaks with the <br> tag.
I seems strange. I saw replasment at Spammer.class line 245

if (this.messageFormat == 0) {
this.message.setContent(text.replaceAll("\n", "<br>"), "text/html; charset=" + charset);
} else {
this.message.setText(text);
}

Maybe some problem with that?
Also i wanted to ask you how gets config values? From table JFORUM_CONFIG or from file?
udittmer


註冊時間: 2013/2/21
文章: 422
離線
What I meant is: if at least one of them has HTML turned on, and at least one of them has it turned off.

Yes, that code section may well be the problem.

Config info is taken from the SystemGlobals.properties and jforum-custom.conf files. The DB table serves mainly as a backup of jforum-custom.conf.

Ping & Net - my free Android app for TCP/IP network diagnostics
[Email] [WWW]
jdev1


註冊時間: 2021/3/22
文章: 33
離線
I've also seen redefinition messageFormat at Spammer.class

private void defineUserMessage(User user) {
try {
this.templateParams.put("user", user);
String text = this.processTemplate();
int oldMessageFormat = this.messageFormat;
if (user.notifyText()) {
this.messageFormat = 0;
}

this.defineMessageText(text);
this.messageFormat = oldMessageFormat;
} catch (Exception var4) {
throw new MailException(var4);
}
}


What is the function user.notifyText()? Is it related with "Allow HTML" you wrote about earlier or something else?
udittmer


註冊時間: 2013/2/21
文章: 422
離線
Yes, that's exactly what it is.

Ping & Net - my free Android app for TCP/IP network diagnostics
[Email] [WWW]
jdev1


註冊時間: 2021/3/22
文章: 33
離線
Can I ask you please to compile a jar file with one change in Spammer.class for me, if it's not difficult.

Instead of
if (this.messageFormat == 0) {
this.message.setContent(text.replaceAll("\n", "<br>"), "text/html; charset=" + charset);
} else {
this.message.setText(text);
}

this:

if (this.messageFormat == 0) {
this.message.setContent(text, "text/html; charset=utf-8");
} else {
this.message.setText(text);
}

If it helps in my situation I will be very grateful. Thank you.
udittmer


註冊時間: 2013/2/21
文章: 422
離線
That doesn't look like the right fix, but don't worry - I already have a fix, and just need to test it. Patience smilie

Ping & Net - my free Android app for TCP/IP network diagnostics
[Email] [WWW]
jdev1


註冊時間: 2021/3/22
文章: 33
離線
Ok, i'm waiting, thanks for helping
udittmer


註冊時間: 2013/2/21
文章: 422
離線
My reading of the situation was pretty much completely wrong, including the use of the "Allow HTML" setting. The relevant setting that goes with "notifyText" is actually "Include the message contents within the notification email".

But that doesn't seem to have to do anything with the bug, which I suspect is caused by reusing the MimeMessage object. I need to look into avoiding that.

Ping & Net - my free Android app for TCP/IP network diagnostics
[Email] [WWW]
udittmer


註冊時間: 2013/2/21
文章: 422
離線
Turns out that there were not one, but two bugs in the mail sending code - which must have been there for ages, without anyone ever noticing them. Kudos for triggering them! smilie

Ping & Net - my free Android app for TCP/IP network diagnostics
[Email] [WWW]
udittmer


註冊時間: 2013/2/21
文章: 422
離線
You can try this jar file - it has the mail sending fixes.
 檔案名稱 jforum-2.8.2.jar [Disk] 下載
 描述 JForum 2.8.2 with all the latest fixes
 檔案大小 689 Kbytes
 下載次數:  356 次


Ping & Net - my free Android app for TCP/IP network diagnostics
[Email] [WWW]
jdev1


註冊時間: 2021/3/22
文章: 33
離線
Looks like that works fine. Thank you!
jdev1


註冊時間: 2021/3/22
文章: 33
離線
Hi! I have one more question.
Users complain that they do not receive notifications about new responses. In the admin panel, I send a test email and get an error like in the screenshot. After that, I send the test email again and it is sent perfectly, and notifications begin to arrive to users. And after about 1-2 hours, everything repeats. What could be the matter?
  • [Thumb - 2023-03-17_20-21-25.png]
 檔案名稱 2023-03-17_20-21-25.png [Disk] 下載
 描述 沒有檔案註解存在
 檔案大小 7 Kbytes
 下載次數:  303 次

udittmer


註冊時間: 2013/2/21
文章: 422
離線
"Connection reset" frequently points to a networking issue rather than an application issue. You can add "mail.debug=true" to the mail properties on the Config page. After restarting the web app you should then see lots of debugging output in the logs; maybe that points to something.

Ping & Net - my free Android app for TCP/IP network diagnostics
[Email] [WWW]
jdev1


註冊時間: 2021/3/22
文章: 33
離線
I've got this message at jforum.log

2023-03-21 15:27:33,374 ERROR [AjaxAction] - net.jforum.exceptions.MailException: jakarta.mail.MessagingException: Exception reading response;
nested exception is:
java.net.SocketException: Connection reset
net.jforum.exceptions.MailException: jakarta.mail.MessagingException: Exception reading response;
nested exception is:
java.net.SocketException: Connection reset
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:2476)
at com.sun.mail.smtp.SMTPTransport.ehlo(SMTPTransport.java:1684)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:726)
at jakarta.mail.Service.connect(Service.java:342)
at jakarta.mail.Service.connect(Service.java:222)
at net.jforum.util.mail.Spammer.dispatchMessages(Spammer.java:208)
at net.jforum.view.forum.AjaxAction.sendTestMail(AjaxAction.java:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.jforum.Command.process(Command.java:122)
at net.jforum.JForum.processCommand(JForum.java:269)
at net.jforum.JForum.service(JForum.java:251)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at net.jforum.csrf.CsrfFilter.doFilter(CsrfFilter.java:104)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at net.jforum.util.legacy.clickstream.ClickstreamFilter.doFilter(ClickstreamFilter.java:59)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:610)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:503)
at java.lang.Thread.run(Unknown Source)
Caused by: jakarta.mail.MessagingException: Exception reading response;
nested exception is:
java.net.SocketException: Connection reset
... 34 more
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:102)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:100)
at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:2456)
... 33 more
udittmer


註冊時間: 2013/2/21
文章: 422
離線
That's JForum logging output, which doesn't add anything to the exception you posted earlier. What you want is the JavaMail debug output.

Ping & Net - my free Android app for TCP/IP network diagnostics
[Email] [WWW]
 
討論區首頁 » User Forum
前往:   
行動版
Powered by JForum 2.8.3 © 2023 JForum Team • Maintained by Andowson Chang and Ulf Dittmer