2 Replies Latest reply on Mar 17, 2016 7:10 AM by Mike Reider

    Email notifications not working

    Mike Reider

      Running jobs in BSA 8.6.01.66 (rhel 5.11) and trying to get notifications for fail or success

       

      blasadmin show email all  shows the proper From address (root@appserverName.domain.com) and proper smtp server, we tested comms for the smtp, telnet through port 25, port is open. We can also send email directly from the appserver on cmd line using mailx

       

      getting this in appserver.log, not many details. Also the /var/log/maillog doesnt show any messages or activity. Not sure where else to check. What is BSA using as its mailing mechanism?? Im guessing a java email library?

       

      [16 Mar 2016 06:52:24,477] [Job-Execution-3] [ERROR] [BLAdmin:BLAdmins:] [Deploy] Exception reading response

      javax.mail.MessagingException: Exception reading response;

        nested exception is:

              java.net.SocketException: Connection reset

              at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1462)

              at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1260)

              at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)

              at javax.mail.Service.connect(Service.java:275)

              at javax.mail.Service.connect(Service.java:156)

              at javax.mail.Service.connect(Service.java:105)

              at com.bladelogic.om.infra.app.util.EmailUtil.sendEmail(EmailUtil.java:273)

              at com.bladelogic.om.infra.app.util.EmailUtil.sendJobRunStatusNotify(EmailUtil.java:100)

              at com.bladelogic.om.infra.app.util.NotificationUtil.sendJobRunStatusNotify(NotificationUtil.java:189)

              at com.bladelogic.om.infra.app.util.NotificationUtil.sendNotifications(NotificationUtil.java:91)

              at com.bladelogic.om.deploy.model.job.BaseDeployJobExecutor.sendNotifications(BaseDeployJobExecutor.java:1223)

              at com.bladelogic.om.infra.app.service.job.JobExecutor.endJobExecution(JobExecutor.java:1482)

              at com.bladelogic.om.infra.model.job.executor.ServerBasedJobExecutor.endJobExecution(ServerBasedJobExecutor.java:358)

              at com.bladelogic.om.deploy.model.job.BaseDeployJobExecutor.checkForJobExecutionEnd(BaseDeployJobExecutor.java:285)

              at com.bladelogic.om.infra.app.service.job.JobExecutor.processResults(JobExecutor.java:339)

              at com.bladelogic.om.infra.app.service.job.execution.JobExecutionThread.execute(JobExecutionThread.java:131)

              at com.bladelogic.om.infra.app.service.job.execution.JobExecutionThread.execute(JobExecutionThread.java:25)

              at com.bladelogic.om.infra.app.service.thread.BlBlockingThread.run(BlBlockingThread.java:95)

      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:97)

              at java.io.BufferedInputStream.fill(Unknown Source)

              at java.io.BufferedInputStream.read(Unknown Source)

              at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:75)

              at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1440)

              ... 17 more

      [16 Mar 2016 06:52:24,481] [Job-Execution-3] [WARN] [BLAdmin:BLAdmins:] [Deploy] Failed to send notifications.

      com.bladelogic.om.infra.mfw.util.BlException: SMTP job run status notification for job AIX_PATCH_PRE_Validation_bl failed due to: Unable to send email. Please check your mail configuration.

              at com.bladelogic.om.infra.app.util.NotificationUtil.sendNotifications(NotificationUtil.java:121)

              at com.bladelogic.om.deploy.model.job.BaseDeployJobExecutor.sendNotifications(BaseDeployJobExecutor.java:1223)

              at com.bladelogic.om.infra.app.service.job.JobExecutor.endJobExecution(JobExecutor.java:1482)

              at com.bladelogic.om.infra.model.job.executor.ServerBasedJobExecutor.endJobExecution(ServerBasedJobExecutor.java:358)

              at com.bladelogic.om.deploy.model.job.BaseDeployJobExecutor.checkForJobExecutionEnd(BaseDeployJobExecutor.java:285)

              at com.bladelogic.om.infra.app.service.job.JobExecutor.processResults(JobExecutor.java:339)

              at com.bladelogic.om.infra.app.service.job.execution.JobExecutionThread.execute(JobExecutionThread.java:131)

              at com.bladelogic.om.infra.app.service.job.execution.JobExecutionThread.execute(JobExecutionThread.java:25)

              at com.bladelogic.om.infra.app.service.thread.BlBlockingThread.run(BlBlockingThread.java:95)

        • 1. Re: Email notifications not working
          Mike Reider

          guessing its something like this,

           

          1

          2

          3

          4

          5

          6

          7

          8

          9

          10

          11

          12

          13

          14

          15

          16

          17

          18

          19

          20

          21

          22

          23

          24

          25

          26

          27

          28

          29

          30

          31

          32

          33

          34

          35

          36

          37

          38

          39

          40

          41

          42

          43

          44

          45

          46

          47

          48

          49

          50

          51

          52

          53

          54

          55

          56

          57

          58

           

          package com.journaldev.mail;

           

           

          import java.io.UnsupportedEncodingException;

          import java.util.Date;

           

          import javax.activation.DataHandler;

          import javax.activation.DataSource;

          import javax.activation.FileDataSource;

          import javax.mail.BodyPart;

          import javax.mail.Message;

          import javax.mail.MessagingException;

          import javax.mail.Multipart;

          import javax.mail.Session;

          import javax.mail.Transport;

          import javax.mail.internet.InternetAddress;

          import javax.mail.internet.MimeBodyPart;

          import javax.mail.internet.MimeMessage;

          import javax.mail.internet.MimeMultipart;

           

          public class EmailUtil {

           

              /**

               * Utility method to send simple HTML email

               * @param session

               * @param toEmail

               * @param subject

               * @param body

               */

              public static void sendEmail(Session session, String toEmail, String subject, String body){

                  try

                  {

                    MimeMessage msg = new MimeMessage(session);

                    //set message headers

                    msg.addHeader("Content-type", "text/HTML; charset=UTF-8");

                    msg.addHeader("format", "flowed");

                    msg.addHeader("Content-Transfer-Encoding", "8bit");

           

                    msg.setFrom(new InternetAddress("no_reply@journaldev.com", "NoReply-JD"));

           

                    msg.setReplyTo(InternetAddress.parse("no_reply@journaldev.com", false));

           

                    msg.setSubject(subject, "UTF-8");

           

                    msg.setText(body, "UTF-8");

           

                    msg.setSentDate(new Date());

           

                    msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(toEmail, false));

                    System.out.println("Message is ready");

                    Transport.send(msg); 

           

                    System.out.println("EMail Sent Successfully!!");

                  }

                  catch (Exception e) {

                    e.printStackTrace();

                  }

              }

          }

           

           

          going to set the appserver log to verbose and see if I can get a better debug msg

          • 2. Re: Email notifications not working
            Mike Reider

            looks like smtp relay server had a blacklist setup that was blocking outgoing email. Admins put in a whitelist rule for Blade and its now sending emails