You might try setting the "mail.debug" property in the Geronimo mail session configuration to see what the traffic between the client and the server look like. Also, please include the version of Geronimo you're running with, as potential solutions can differ with the version involved.

Rick

ASHOK PORALU wrote:
Hi,

I am using Apache Geronimo's default JavaMail session and Apache JAMES smtp server to send mails from my application. As per JSP code I am able see the result as message sent but I have not received any mails to destination mail account.

Here is the JSP code.

<[EMAIL PROTECTED] import="java.util.Date,
                javax.mail.Message,
                javax.mail.Session,
                javax.mail.Transport,
                javax.mail.internet.InternetAddress ,
                javax.mail.internet.MimeMessage,
                javax.naming.InitialContext" %>

<%
    String resultMsg = "";
    String action = request.getParameter("action");
    if ("Send".equals(action)) {
        String from = request.getParameter("from");
        String to = request.getParameter("to");
        String subject = request.getParameter ("subject");
        String content = request.getParameter("message");

        // Get mail session and transport
        InitialContext context = new InitialContext();
        // Mail session from web.xml's resource reference
Session mailSession = (Session) context.lookup("java:comp/env/mail/testMailSession");
        Transport transport = mailSession.getTransport("smtp");
// Setup message
        MimeMessage message = new MimeMessage(mailSession);
        // From address
        message.setFrom(new InternetAddress(from));
        // To address
message.addRecipient (Message.RecipientType.TO <http://Message.RecipientType.TO>, new InternetAddress(to));
        // Subject
        message.setSubject (subject);
        // Content
        message.setText(content);
// Send message
        transport.connect();
        transport.send(message);
// Build result message
        resultMsg = "<b>Result:</b>";
        resultMsg += "<br>Message sent: " + new Date();
        resultMsg += "<br>To: " + to;
        resultMsg += "<br>From: " + from;
    }
%>

<html>
    <head>
        <title>Send Mail</title>
    </head>
    <body>
        <form>
            <table>
                <tr>
                    <td align="center" colspan="2"><b>Send Mail</b></td>
                </tr>
                <tr>
                    <td align="right">From:</td>
                    <td><input type="text" name="from"></td>
                </tr>
                <tr>
                    <td align="right">To:</td>
                    <td><input type="text" name="to"></td>
                </tr>
                <tr>
                    <td align="right">Subject:</td>
                    <td><input type="text" name="subject"></td>
                </tr>
                <tr>
                    <td align="right">Message:</td>
<td><textarea rows="5" cols="20" name="message"></textarea></td>
                </tr>
                <tr>
                    <td align="right" colspan="2">
<input type="submit" name="action" value="Send">&nbsp;<input type="reset"></td>
                    </td>
                </tr>
            </table>
        </form>
        <%= resultMsg %>
    </body>
</html>

Can anyone provide advice or solution to this case. I appreciate your help.

Thanks in advance

regards,
Ashok

Reply via email to