diff --git a/.github/workflows/quickstart_mail_ci.yml b/.github/workflows/quickstart_mail_ci.yml
index 5d602100ad..2e68ee06ea 100644
--- a/.github/workflows/quickstart_mail_ci.yml
+++ b/.github/workflows/quickstart_mail_ci.yml
@@ -1,11 +1,13 @@
name: WildFly Mail Quickstart CI
-on:
- pull_request:
- types: [opened, synchronize, reopened, ready_for_review]
- paths:
- - 'mail/**'
- - '.github/workflows/quickstart_ci.yml'
+#on:
+# pull_request:
+# types: [opened, synchronize, reopened, ready_for_review]
+# paths:
+# - 'mail/**'
+# - '.github/workflows/quickstart_ci.yml'
+
+on: workflow_dispatch
jobs:
call-quickstart_ci:
uses: ./.github/workflows/quickstart_ci.yml
@@ -13,3 +15,4 @@ jobs:
QUICKSTART_PATH: mail
TEST_PROVISIONED_SERVER: true
TEST_OPENSHIFT: false
+ MATRIX_OS: '"ubuntu-20.04"'
diff --git a/.github/workflows/quickstart_mail_ci_before.sh b/.github/workflows/quickstart_mail_ci_before.sh
new file mode 100755
index 0000000000..66cf6ff715
--- /dev/null
+++ b/.github/workflows/quickstart_mail_ci_before.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# Start apache James with the required configuration
+docker run -d --rm --name "apache-james" \
+ -p 1465:465 \
+ -p 1993:993 \
+ -p 1025:25 \
+ -p 1110:110 \
+ -p 1587:587 \
+ -p 1143:143 \
+ -v ${GITHUB_WORKSPACE}/quickstarts/mail/mail-server-conf/imapserver.xml:/root/conf/imapserver.xml \
+ -v ${GITHUB_WORKSPACE}/quickstarts/mail/mail-server-conf/pop3server.xml:/root/conf/pop3server.xml \
+ -v ${GITHUB_WORKSPACE}/quickstarts/mail/mail-server-conf/smtpserver.xml:/root/conf/smtpserver.xml \
+ apache/james:demo-3.8.0
diff --git a/mail/Dockerfile b/mail/Dockerfile
deleted file mode 100644
index 4e78f68f7e..0000000000
--- a/mail/Dockerfile
+++ /dev/null
@@ -1,14 +0,0 @@
-FROM linagora/james-jpa-sample:3.0.1
-
-RUN chgrp -R 0 /root /logs /var && \
- chmod -R g=u /root /logs /var && \
- sed -i s/:143/:1143/g /root/conf/imapserver.xml && \
- sed -i s/:993/:1993/g /root/conf/imapserver.xml && \
- sed -i s/:110/:1110/g /root/conf/pop3server.xml && \
- sed -i s/:25/:1025/g /root/conf/smtpserver.xml && \
- sed -i s/:465/:1465/g /root/conf/smtpserver.xml && \
- sed -i s/:587/:1587/g /root/conf/smtpserver.xml
-
-RUN echo "touch /root/done.mark" >> /root/initialdata.sh
-
-ENTRYPOINT ["/root/startup.sh"]
\ No newline at end of file
diff --git a/mail/docker-compose.yaml b/mail/docker-compose.yaml
index e70e4049e8..f20af5c8a5 100644
--- a/mail/docker-compose.yaml
+++ b/mail/docker-compose.yaml
@@ -11,6 +11,12 @@ services:
- "1587:587"
- "1143:143"
volumes:
- - "./mail-server-conf/imapserver.xml:/root/conf/imapserver.xml"
- - "./mail-server-conf/pop3server.xml:/root/conf/pop3server.xml"
- - "./mail-server-conf/smtpserver.xml:/root/conf/smtpserver.xml"
+ - ./mail-server-conf/imapserver.xml:/root/conf/imapserver.xml
+ - ./mail-server-conf/pop3server.xml:/root/conf/pop3server.xml
+ - ./mail-server-conf/smtpserver.xml:/root/conf/smtpserver.xml
+ healthcheck:
+ test: [ "CMD-SHELL", "/bin/james-cli -h 127.0.0.1 -p 9999 ListUsers | grep -q 'user03@james.local'" ]
+ interval: 5s
+ timeout: 1m
+ retries: 5
+ start_period: 20s
diff --git a/mail/pom.xml b/mail/pom.xml
index 6cccd019bd..69b557d8ec 100644
--- a/mail/pom.xml
+++ b/mail/pom.xml
@@ -49,6 +49,9 @@
${version.server}
4.2.0.Final
+
+ 4.15.0
+ 5.6.2
@@ -148,6 +151,18 @@
junit
test
+
+ org.seleniumhq.selenium
+ selenium-java
+ ${version.org.seleniumhq.selenium}
+ test
+
+
+
+ io.github.bonigarcia
+ webdrivermanager
+ ${version.webdrivermanager}
+
@@ -191,6 +206,7 @@
+ core-tools
core-server
mail
jsf
diff --git a/mail/src/main/java/org/jboss/as/quickstarts/mail/Email.java b/mail/src/main/java/org/jboss/as/quickstarts/mail/Email.java
index c97758ba48..0e76b078da 100644
--- a/mail/src/main/java/org/jboss/as/quickstarts/mail/Email.java
+++ b/mail/src/main/java/org/jboss/as/quickstarts/mail/Email.java
@@ -17,9 +17,9 @@
package org.jboss.as.quickstarts.mail;
import jakarta.annotation.Resource;
+import jakarta.enterprise.context.SessionScoped;
import jakarta.faces.application.FacesMessage;
import jakarta.faces.context.FacesContext;
-import jakarta.faces.view.ViewScoped;
import jakarta.inject.Named;
import jakarta.mail.Address;
import jakarta.mail.Folder;
@@ -31,6 +31,7 @@
import jakarta.mail.internet.InternetAddress;
import jakarta.mail.internet.MimeMessage;
+import java.io.IOException;
import java.io.Serializable;
/**
@@ -51,7 +52,7 @@
*/
@Named
-@ViewScoped
+@SessionScoped
public class Email implements Serializable {
private static final long serialVersionUID = 1544680932114626710L;
@@ -72,7 +73,9 @@ public class Email implements Serializable {
private String body;
private String pop3User = "user02@james.local";
+
private String pop3Password = "1234";
+
private String pop3Emails;
private String imapEmails;
@@ -111,9 +114,14 @@ public void resetSmtp() {
public void retrievePop3() throws Exception {
try {
pop3Emails = retrieveEmails("pop3", pop3User, pop3Password);
+ if (pop3Emails == null) {
+ FacesContext context = FacesContext.getCurrentInstance();
+ FacesMessage facesMessage = new FacesMessage("No message found.");
+ context.addMessage(null, facesMessage);
+ }
} catch (Exception e) {
FacesContext context = FacesContext.getCurrentInstance();
- FacesMessage facesMessage = new FacesMessage("Error retrieving emails using Pop3. " + e.getMessage());
+ FacesMessage facesMessage = new FacesMessage("Error retrieving emails using POP3. " + e.getMessage());
context.addMessage(null, facesMessage);
}
}
@@ -127,9 +135,14 @@ public void resetPop3() {
public void retrieveImap() throws Exception {
try {
imapEmails = retrieveEmails("imap");
+ if (imapEmails == null) {
+ FacesContext context = FacesContext.getCurrentInstance();
+ FacesMessage facesMessage = new FacesMessage("No message found.");
+ context.addMessage(null, facesMessage);
+ }
} catch (Exception e) {
FacesContext context = FacesContext.getCurrentInstance();
- FacesMessage facesMessage = new FacesMessage("Error retrieving emails using Pop3. " + e.getMessage());
+ FacesMessage facesMessage = new FacesMessage("Error retrieving emails using IMAP. " + e.getMessage());
context.addMessage(null, facesMessage);
}
}
@@ -138,11 +151,11 @@ public void resetImap() {
imapEmails = null;
}
- private String retrieveEmails(String protocol) throws MessagingException {
+ private String retrieveEmails(String protocol) throws MessagingException, IOException {
return retrieveEmails(protocol, null, null);
}
- private String retrieveEmails(String protocol, String user, String password) throws MessagingException {
+ private String retrieveEmails(String protocol, String user, String password) throws MessagingException, IOException {
Store store = mySession.getStore(protocol);
if (user != null && !user.trim().isEmpty()) {
store.connect(user, password);
@@ -158,10 +171,6 @@ private String retrieveEmails(String protocol, String user, String password) thr
Message[] messages = inbox.getMessages();
if (messages.length == 0) {
- FacesContext context = FacesContext.getCurrentInstance();
- FacesMessage facesMessage = new FacesMessage("No message found for " + user);
- context.addMessage(null, facesMessage);
-
return null;
}
@@ -176,6 +185,7 @@ private String retrieveEmails(String protocol, String user, String password) thr
sb.append("Message ").append((i + 1)).append("\n");
sb.append("From : ").append(messages[i].getFrom()[0]).append("\n");
sb.append("Subject : ").append(messages[i].getSubject()).append("\n");
+ sb.append("Body : ").append(messages[i].getContent().toString()).append("\n");
sb.append("Sent Date : ").append(messages[i].getSentDate()).append("\n");
sb.append("----------------------------------").append("\n");
}
diff --git a/mail/src/main/webapp/home.xhtml b/mail/src/main/webapp/home.xhtml
index e25c871526..4179bafde5 100644
--- a/mail/src/main/webapp/home.xhtml
+++ b/mail/src/main/webapp/home.xhtml
@@ -36,39 +36,39 @@
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
+
-
+
-
+
@@ -79,32 +79,32 @@
-
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
-
+
-
+
-
+
@@ -115,20 +115,20 @@
-
-
+
+
-
+
-
+
-
+