Error while sending Email through Java Code in OIM

Hi All,
I have created a java code using tcEmailNotificationUtil, and integrated the same with the adapter.
I am triggering this adapter when an approval process gets completed.
As soon as the approval process gets completed my email task is triggering but the task is getting rejected.
I have checked my system configuration for mail server settings.Everything seems working fine.
Can you please help me in this issue how to debug?
Thanks in advance.

Hi,
Here is my log file:
DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/insertTaskHistory left.
DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/run entered.
DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: ReIssueAuditMessage/execute entered.
DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: ReIssueAuditMessage/initialize entered.
DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/getAttribute entered.
DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/getAttribute left.
DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/getUtility entered.
DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/getUtility left.
DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.ACCOUNTMANAGEMENT] - Class/Method: tcUtilityFactory/getRemoteUtility - Data: moUtil - Value: Thor.API.Operations.tcAuditOperationsClient
DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: ReIssueAuditMessage/initialize left.
DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: ReIssueAuditMessage/processAllByIdentifier entered.
DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isStopped entered.
DEBUG,25 Apr 2011 10:40:00,099,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isStopped left.
DEBUG,25 Apr 2011 10:40:00,100,[XELLERATE.DATABASE] - select A.* from (select aud_jms_key, aud_class, identifier from aud_jms order by aud_jms_key) A where rownum <= ?
INFO,25 Apr 2011 10:40:00,101,[XELLERATE.PERFORMANCE] - Query: DB: 1, LOAD: 0, TOTAL: 1
DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isStopped entered.
DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isStopped left.
DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isStopped entered.
DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isStopped left.
DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: ReIssueAuditMessage/execute left.
DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/run left.
DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isSuccess entered.
DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SCHEDULER.TASK] - Class/Method: SchedulerBaseTask/isSuccess left.
DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SERVER] - Class/Method: SchedulerTaskLocater /removeLocalTask entered.
DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SERVER] - Class/Method: SchedulerTaskLocater /removeLocalTask left.
DEBUG,25 Apr 2011 10:40:00,102,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/updateStatusToInactive entered.
DEBUG,25 Apr 2011 10:40:00,104,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/updateStatusToInactive left.
DEBUG,25 Apr 2011 10:40:00,104,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/updateTaskHistory entered.
DEBUG,25 Apr 2011 10:40:00,106,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/updateTaskHistory left.
DEBUG,25 Apr 2011 10:40:00,106,[XELLERATE.SERVER] - Clearing Security Associations with thread executing Scheduled task
DEBUG,25 Apr 2011 10:40:00,106,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/run left.
DEBUG,25 Apr 2011 10:40:00,106,[XELLERATE.SERVER] - Class/Method: QuartzWrapper/execute left.
and I just wanted to ensure that my coding part is also fine.
Posting the code even:
tcDataProvider ioDatabase = new tcDataBaseClient();
tcEmailNotificationUtil sendMail = new tcEmailNotificationUtil(ioDatabase);
sendMail.setBody("Sample Message");
sendMail.setSubject("subject");
sendMail.setFromAddress("fromemailaddress");
sendMail.sendEmail("recepient");
Thanks in Advance.

Similar Messages

  • Problem: Error while sending Email.(Java Mail API)

    Hi to ALL
    I am trying to build Application to send Email
    Below code is primary code to send Email to other smtp host.
    & also debug information is as shown below.
    If possible, then please send the solution.
    -------------------------------Code :-----------------------------------------
    URLName urlN=new URLName("smtps://"+userNm+":"+passwd+"@"+host);
    Properties props = System.getProperties();
    Session session = Session.getDefaultInstance(props);
    session.setDebug(true);
    Message msg = new MimeMessage(session);
    msg.setFrom(new InternetAddress(from));
    InternetAddress[] address= InternetAddress.parse(to, false);
    msg.setRecipients(MimeMessage.RecipientType.TO, address);
    msg.setSubject("subject");
    msg.setContent("messageSend Hi", "text/plain");
    Transport transport=session.getTransport(urlN);
    transport.connect();
    transport.sendMessage(msg, address);
    ---------- Java Run ----------
    DEBUG: setDebug: JavaMail version 1.3.2
    DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc]
    DEBUG SMTP: useEhlo true, useAuth false
    DEBUG SMTP: trying to connect to host "hostName", port 465, isSSL true
    220 smtp110.mail.mud.yahoo.com ESMTP
    DEBUG SMTP: connected to host "hostName", port: 465
    EHLO patil
    250-smtp110.mail.mud.yahoo.com
    250-AUTH LOGIN PLAIN XYMCOOKIE
    250-PIPELINING
    250 8BITMIME
    DEBUG SMTP: Found extension "AUTH", arg "LOGIN PLAIN XYMCOOKIE"
    DEBUG SMTP: Found extension "PIPELINING", arg ""
    DEBUG SMTP: Found extension "8BITMIME", arg ""
    DEBUG SMTP: use8bit false
    MAIL FROM:<from email address>
    530 authentication required - for help go to http://help.yahoo.com/help/us/mail/pop/pop-11.html
    com.sun.mail.smtp.SMTPSendFailedException: 530 authentication required - for help go to http://help.yahoo.com/help/us/mail/pop/pop-11.html
    at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1275)
    at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:895)
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:524)
    at SendEmail2.<init>(SendEmail2.java:46)
    at SendEmail2.main(SendEmail2.java:23)
    Exception : com.sun.mail.smtp.SMTPSendFailedException: 530 authentication required - for help go to
    http://help.yahoo.com/help/us/mail/pop/pop-11.htmls
    -------------------------------------------------------------------------------------

    It's possible. It's only software, after all.
    But it's not easy. It effectively involves
    screen scraping the HTML pages.
    There used to be a third party JavaMail provider
    that did all the hard work, but it has disappeared.

  • Error while sending email using TemplateEmailSender in CSC server

    Hi,
    We are trying to send email using TemplateEmailSender from CSC server. But it is giving Null Pointer Exception in ProfiledMessageSource like below. The same code is working fine in commerce instance but it is failing in CSC instance. We are using ATG2007.1p3
    Any pointers would be helpful.
    Below is the error.
    Error while sending email
    java.lang.NullPointerException
            at atg.userprofiling.dms.ProfiledMessageSource.isConfiguredForProfileSubject(ProfiledMessageSource.java:196)
            at atg.userprofiling.dms.DPSMessageSource.fireEndSessionMessage(DPSMessageSource.java:864)
            at atg.userprofiling.dms.DPSMessageSource.fireEndSessionMessage(DPSMessageSource.java:848)
            at atg.userprofiling.SessionEventTrigger.nameContextElementPreUnbound(SessionEventTrigger.java:553)
            at atg.nucleus.GenericContext.sendPreUnboundEvent(GenericContext.java:200)
            at atg.nucleus.GenericContext.preNotifyRemovedObject(GenericContext.java:528)
            at atg.nucleus.GenericContext.removeElement(GenericContext.java:566)
            at atg.servlet.SessionNameContext.unbindFromNameContext(SessionNameContext.java:557)
            at atg.servlet.SessionNameContext.stopSession(SessionNameContext.java:534)
            at atg.servlet.SessionNameContext.decrementWrapperCount(SessionNameContext.java:242)
            at atg.servlet.SessionBindingReporter.valueUnbound(SessionBindingReporter.java:206)
            at org.apache.catalina.session.StandardSession.removeAttributeInternal(StandardSession.java:1625)
            at org.apache.catalina.session.StandardSession.expire(StandardSession.java:749)
            at org.apache.catalina.session.StandardSession.expire(StandardSession.java:655)
            at org.apache.catalina.session.StandardSession.invalidate(StandardSession.java:1100)
            at org.apache.catalina.session.StandardSessionFacade.invalidate(StandardSessionFacade.java:150)
            at atg.userprofiling.email.TemplateInvoker$TemplateSession.endSession(TemplateInvoker.java:935)
            at atg.userprofiling.email.TemplateEmailSender.createMessage(TemplateEmailSender.java:2387)

    Thanks for the reply.
    My issue is fixed now. It is JBOSS configuration issue. Sessions are not maintained properly that's why we are getting NULL profile in the session. Our application has multiple WARs so we fixed it by setting emptySessionPath to TRUE. If emptySessionPath attribute in server.xml is false, then each WAR will have its own jsessionid cookie.
    I did not touch ProfiledMessageSource as its required for session triggering.

  • Error while sending email to external mail - Urgent

    Hi All,
    I am getting error while sending email with attachement. The Error code is 02.
    I am not able to identify the error. bold Please help me in solving this problem.
    Is it anything wrong with the code or Any Configuration with SCOT/SOST.bold
    the code i am using is :
    REPORT YVR_F MESSAGE-ID XX .
    TABLES : EDIDC, EDIDS, EDPAR.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
    PARAMETERS : P_STATUS LIKE EDIDC-STATUS DEFAULT '51'.
    SELECT-OPTIONS : S_DIRECT FOR EDIDC-DIRECT,
                     S_MESTYP FOR EDIDC-MESTYP,
                     S_CREDAT FOR EDIDC-CREDAT.
    SELECTION-SCREEN END OF BLOCK B1 .
    PARAMETER: P_EMAIL LIKE SOMLRECI1-RECEIVER,
               P_SENDER LIKE SOMLRECI1-RECEIVER no-display,
               P_DELSPL  AS CHECKBOX,
               P_ONLINE NO-DISPLAY.
    DATA : TB_EDIDC LIKE STANDARD TABLE OF EDIDC INITIAL SIZE 0 WITH HEADER
    LINE.
    DATA : TB_EDPAR LIKE STANDARD TABLE OF EDPAR INITIAL SIZE 0 WITH HEADER
    LINE.
    DATA : TB_KNA1 LIKE STANDARD TABLE OF KNA1 INITIAL SIZE 0 WITH HEADER
    LINE.
    DATA : TB_ADRC LIKE STANDARD TABLE OF ADRC INITIAL SIZE 0 WITH HEADER
    LINE.
    DATA: INT_PDF TYPE TABLE OF TLINE WITH HEADER LINE.
    DATA : BEGIN OF TB_ED OCCURS 0,
             SNDPRN LIKE EDIDC-SNDPRN,
             LOC    LIKE ADRC-BUILDING,
             DOCNUM LIKE EDIDC-DOCNUM,
             IDOCTP LIKE EDIDC-IDOCTP,
             MESTYP LIKE EDIDC-MESTYP,
             DIRECT LIKE EDIDC-DIRECT,
             CREDAT LIKE EDIDC-CREDAT,
             STATUS LIKE EDIDC-STATUS,
           END OF TB_ED.
    DATA:   IT_MESSAGE TYPE STANDARD TABLE OF SOLISTI1 INITIAL SIZE 0
                    WITH HEADER LINE.
    DATA:   IT_ATTACH TYPE STANDARD TABLE OF SOLISTI1 INITIAL SIZE 0
                    WITH HEADER LINE.
    Job Runtime Parameters
    DATA: GD_EVENTID LIKE TBTCM-EVENTID,
          GD_EVENTPARM LIKE TBTCM-EVENTPARM,
          GD_EXTERNAL_PROGRAM_ACTIVE LIKE TBTCM-XPGACTIVE,
          GD_JOBCOUNT LIKE TBTCM-JOBCOUNT,
          GD_JOBNAME LIKE TBTCM-JOBNAME,
          GD_STEPCOUNT LIKE TBTCM-STEPCOUNT,
          GD_ERROR    TYPE SY-SUBRC,
          GD_RECIEVER TYPE SY-SUBRC.
    DATA:  W_RECSIZE TYPE I,
           W_SPOOL_NR LIKE SY-SPONO.
          %_print LIKE pri_params.
    DATA: GD_SUBJECT   LIKE SODOCCHGI1-OBJ_DESCR,
          IT_MESS_BOD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
          IT_MESS_ATT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
          GD_SENDER_TYPE     LIKE SOEXTRECI1-ADR_TYP,
          GD_ATTACHMENT_DESC TYPE SO_OBJ_NAM,
          GD_ATTACHMENT_NAME TYPE SO_OBJ_DES.
    Spool to PDF conversions
    DATA: GD_SPOOL_NR LIKE TSP01-RQIDENT,
          GD_DESTINATION LIKE RLGRAP-FILENAME,
          GD_BYTECOUNT LIKE TST01-DSIZE,
          GD_BUFFER TYPE STRING.
    Binary store for PDF
    DATA: BEGIN OF IT_PDF_OUTPUT OCCURS 0.
            INCLUDE STRUCTURE TLINE.
    DATA: END OF IT_PDF_OUTPUT.
    DATA: GD_RECSIZE TYPE I.
    CONSTANTS: C_DEV LIKE  SY-SYSID VALUE 'DEV',
               C_NO(1)     TYPE C   VALUE ' ',
               C_DEVICE(4) TYPE C   VALUE 'LOCL'.
    DATA:   T_PACKING_LIST LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
            T_CONTENTS LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
            T_RECEIVERS LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
            T_ATTACHMENT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
            T_OBJECT_HEADER LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
            W_CNT TYPE I,
            W_SENT_ALL(1) TYPE C,
            W_DOC_DATA LIKE SODOCCHGI1.
    DATA : MSTR_PRINT_PARMS LIKE PRI_PARAMS,
           MC_VALID,
           P_REPID LIKE SY-REPID,
           WF_ID  LIKE TSP01-RQIDENT,
           LOC_BYTECOUNT TYPE I.
    *start-of-selection.
    MSTR_PRINT_PARMS-PDEST = 'LOCL'.
    P_REPID = SY-REPID.
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
    EXPORTING
        authority= ' '
       COPIES                       = '1'
       COVER_PAGE                   = SPACE
       DATA_SET                     = SPACE
       DEPARTMENT                   = SPACE
       DESTINATION                  = 'LP01'
       EXPIRATION                   = '1'
       IMMEDIATELY                  = 'X'
       LAYOUT                       = 'X_65_132'
       MODE                         = SPACE
       NEW_LIST_ID                  = 'X'
       NO_DIALOG                    = 'X'
       USER                         = SY-UNAME
    IMPORTING
       OUT_PARAMETERS               = MSTR_PRINT_PARMS
       VALID                        = MC_VALID
    EXCEPTIONS
       ARCHIVE_INFO_NOT_FOUND       = 1
       INVALID_PRINT_PARAMS         = 2
       INVALID_ARCHIVE_PARAMS       = 3
       OTHERS                       = 4.
         SUBMIT (P_REPID) TO SAP-SPOOL WITHOUT SPOOL DYNPRO
                          SPOOL PARAMETERS MSTR_PRINT_PARMS.
                          AND RETURN.
    NEW-PAGE PRINT ON NO DIALOG PARAMETERS
    MSTR_PRINT_PARMS.
    perform data.
    NEW-PAGE PRINT OFF. "This marks the end of the screen for which the
    *SPOOL NO WAS GENERATED.
    WF_ID = SY-SPONO.
    *converting spool to pdf
    CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
         EXPORTING
              SRC_SPOOLID              = WF_ID  "SPOOL NUMBER
              NO_DIALOG                = SPACE
              PDF_DESTINATION          = 'X'
         IMPORTING
              PDF_BYTECOUNT =
                 LOC_BYTECOUNT "NUMBER OF BYTES TRANSFERRED
         TABLES
              PDF                      = INT_PDF  "TABLE FOR PDF REPORT
         EXCEPTIONS
              ERR_NO_ABAP_SPOOLJOB     = 1
              ERR_NO_SPOOLJOB          = 2
              ERR_NO_PERMISSION        = 3
              ERR_CONV_NOT_POSSIBLE    = 4
              ERR_BAD_DESTDEVICE       = 5
              USER_CANCELLED           = 6
              ERR_SPOOLERROR           = 7
              ERR_TEMSEERROR           = 8
              ERR_BTCJOB_OPEN_FAILED   = 9
              ERR_BTCJOB_SUBMIT_FAILED = 10
              ERR_BTCJOB_CLOSE_FAILED  = 11
              OTHERS                   = 12.
    *CALL FUNCTION 'DOWNLOAD'
    *EXPORTING
    *bin_filesize = loc_bytecount "NO. OF BYTES
    *filename = 'C:/EMAILPDF.PDF'
    *filetype = 'BIN'
    **IMPORTING
    **act_filename = loc_filename
    *TABLES
    *data_tab = int_pdf.
    IF P_DELSPL EQ 'X'.
      PERFORM DELETE_SPOOL.
    ENDIF.
    Transfer the 132-long strings to 255-long strings
    LOOP AT INT_PDF.
      TRANSLATE INT_PDF USING ' ~'.
      CONCATENATE GD_BUFFER INT_PDF INTO GD_BUFFER.
    ENDLOOP.
    TRANSLATE GD_BUFFER USING '~ '.
    DO.
      IT_MESS_ATT = GD_BUFFER.
      APPEND IT_MESS_ATT.
      SHIFT GD_BUFFER LEFT BY 255 PLACES.
      IF GD_BUFFER IS INITIAL.
        EXIT.
      ENDIF.
    ENDDO.
    DESCRIBE TABLE IT_MESS_ATT LINES GD_RECSIZE.
    CHECK GD_RECSIZE > 0.
    PERFORM SENDMAIL USING P_EMAIL..
    *&      Form  sendmail
          text
    -->  p1        text
    <--  p2        text
    FORM SENDMAIL USING P_EMAIL.
      CHECK NOT ( P_EMAIL IS INITIAL ).
      REFRESH IT_MESS_BOD.
    Default subject matter
      GD_SUBJECT         = 'Subject'.
      GD_ATTACHMENT_DESC = 'IDOC LIST'.
    CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      IT_MESS_BOD        = 'List Of Failed Idocs'.
      APPEND IT_MESS_BOD.
      IT_MESS_BOD        = 'List Of Failed Idocs'.
      APPEND IT_MESS_BOD.
    If no sender specified - default blank
      IF P_SENDER EQ SPACE.
        GD_SENDER_TYPE  = SPACE.
      ELSE.
        GD_SENDER_TYPE  = 'INT'.
      ENDIF.
    Send file by email as .xls speadsheet
      PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
                                   TABLES IT_MESS_BOD
                                          IT_MESS_ATT
                                    USING P_EMAIL
                                          'Document attachment'
                                          'PDF'
                                          GD_ATTACHMENT_NAME
                                          GD_ATTACHMENT_DESC
                                          P_SENDER
                                          GD_SENDER_TYPE
                                 CHANGING GD_ERROR
                                          GD_RECIEVER.
    ENDFORM.                    " sendmail
    *&      Form  DELETE_SPOOL
          text
    -->  p1        text
    <--  p2        text
    FORM DELETE_SPOOL.
      DATA: LD_SPOOL_NR TYPE TSP01_SP0R-RQID_CHAR.
      LD_SPOOL_NR = WF_ID.   "GD_SPOOL_NR.
      CHECK P_DELSPL <> C_NO.
      CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
           EXPORTING
                SPOOLID = LD_SPOOL_NR.
    ENDFORM.                    " DELETE_SPOOL
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          text
         -->P_IT_MESS_BOD  text
         -->P_IT_MESS_ATT  text
         -->P_P_EMAIL  text
         -->P_0846   text
         -->P_0847   text
         -->P_GD_ATTACHMENT_NAME  text
         -->P_GD_ATTACHMENT_DESC  text
         -->P_P_SENDER  text
         -->P_GD_SENDER_TYPE  text
         <--P_GD_ERROR  text
         <--P_GD_RECIEVER  text
    FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES   IT_MESSAGE
                                              IT_ATTACH
                                        USING P_EMAIL
                                              P_MTITLE
                                              P_FORMAT
                                              P_FILENAME
                                              P_ATTDESCRIPTION
                                              P_SENDER_ADDRESS
                                              P_SENDER_ADDRES_TYPE
                                     CHANGING P_ERROR
                                              P_RECIEVER.
      DATA: LD_ERROR    TYPE SY-SUBRC,
             LD_RECIEVER TYPE SY-SUBRC,
             LD_MTITLE LIKE SODOCCHGI1-OBJ_DESCR,
             LD_EMAIL LIKE  SOMLRECI1-RECEIVER,
             LD_FORMAT TYPE  SO_OBJ_TP ,
             LD_ATTDESCRIPTION TYPE  SO_OBJ_NAM ,
             LD_ATTFILENAME TYPE  SO_OBJ_DES ,
             LD_SENDER_ADDRESS LIKE  SOEXTRECI1-RECEIVER,
             LD_SENDER_ADDRESS_TYPE LIKE  SOEXTRECI1-ADR_TYP,
             LD_RECEIVER LIKE  SY-SUBRC.
      DATA:   T_PACKING_LIST LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
              T_CONTENTS LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
              T_RECEIVERS LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
              T_ATTACHMENT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
              T_OBJECT_HEADER LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
              W_CNT TYPE I,
              W_SENT_ALL(1) TYPE C,
              W_DOC_DATA LIKE SODOCCHGI1.
      LD_EMAIL   = P_EMAIL.
      LD_MTITLE = P_MTITLE.
      LD_FORMAT              = P_FORMAT.
      LD_ATTDESCRIPTION      = P_ATTDESCRIPTION.
      LD_ATTFILENAME         = P_FILENAME.
      LD_SENDER_ADDRESS      = P_SENDER.
      LD_SENDER_ADDRESS_TYPE = P_SENDER_ADDRES_TYPE.
    Fill the document data.
      W_DOC_DATA-DOC_SIZE = 1.
    Populate the subject/generic message attributes
      W_DOC_DATA-OBJ_LANGU = SY-LANGU.
      W_DOC_DATA-OBJ_NAME  = 'SAPRPT'.
      W_DOC_DATA-OBJ_DESCR = LD_MTITLE .
      W_DOC_DATA-SENSITIVTY = 'F'.
    Fill the document data and get size of attachment
      CLEAR W_DOC_DATA.
      READ TABLE IT_ATTACH INDEX W_CNT.
      W_DOC_DATA-DOC_SIZE =
         ( W_CNT - 1 ) * 255 + STRLEN( IT_ATTACH ).
      W_DOC_DATA-OBJ_LANGU  = SY-LANGU.
      W_DOC_DATA-OBJ_NAME   = 'SAPRPT'.
      W_DOC_DATA-OBJ_DESCR  = LD_MTITLE.
      W_DOC_DATA-SENSITIVTY = 'F'.
      CLEAR T_ATTACHMENT.
      REFRESH T_ATTACHMENT.
      T_ATTACHMENT[] = IT_ATTACH[].
    Describe the body of the message
      CLEAR T_PACKING_LIST.
      REFRESH T_PACKING_LIST.
      T_PACKING_LIST-TRANSF_BIN = SPACE.
      T_PACKING_LIST-HEAD_START = 1.
      T_PACKING_LIST-HEAD_NUM = 0.
      T_PACKING_LIST-BODY_START = 1.
      DESCRIBE TABLE IT_MESSAGE LINES T_PACKING_LIST-BODY_NUM.
      T_PACKING_LIST-DOC_TYPE = 'RAW'.
      APPEND T_PACKING_LIST.
    Create attachment notification
      T_PACKING_LIST-TRANSF_BIN = 'X'.
      T_PACKING_LIST-HEAD_START = 1.
      T_PACKING_LIST-HEAD_NUM   = 1.
      T_PACKING_LIST-BODY_START = 1.
      DESCRIBE TABLE T_ATTACHMENT LINES T_PACKING_LIST-BODY_NUM.
      T_PACKING_LIST-DOC_TYPE   =  LD_FORMAT.
      T_PACKING_LIST-OBJ_DESCR  =  LD_ATTDESCRIPTION.
      T_PACKING_LIST-OBJ_NAME   =  LD_ATTFILENAME.
      T_PACKING_LIST-DOC_SIZE   =  T_PACKING_LIST-BODY_NUM * 255.
      APPEND T_PACKING_LIST.
    Add the recipients email address
      CLEAR T_RECEIVERS.
      REFRESH T_RECEIVERS.
      T_RECEIVERS-RECEIVER = p_EMAIL.
      T_RECEIVERS-REC_TYPE = 'U'.
      T_RECEIVERS-COM_TYPE = 'INT'.
      T_RECEIVERS-NOTIF_DEL = 'X'.
      T_RECEIVERS-NOTIF_NDEL = 'X'.
      APPEND T_RECEIVERS.
      DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
    W_SENT_ALL = 'X'.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           EXPORTING
                DOCUMENT_DATA              = W_DOC_DATA
                PUT_IN_OUTBOX              = 'X'
               SENDER_ADDRESS             = LD_SENDER_ADDRESS
               SENDER_ADDRESS_TYPE        = LD_SENDER_ADDRESS_TYPE
                COMMIT_WORK                = 'X'
           IMPORTING
                SENT_TO_ALL                = W_SENT_ALL
           TABLES
                PACKING_LIST               = T_PACKING_LIST
                object_header              = objhead
                CONTENTS_BIN               = T_ATTACHMENT
                CONTENTS_TXT               = IT_MESSAGE
                RECEIVERS                  = T_RECEIVERS
           EXCEPTIONS
                TOO_MANY_RECEIVERS         = 1
                DOCUMENT_NOT_SENT          = 2
                OPERATION_NO_AUTHORIZATION = 4
                OTHERS                     = 99.
      IF SY-SUBRC NE 0.
        MESSAGE E000 WITH 'Error occurred while sending'.
      ELSE.
        MESSAGE I000 WITH 'The document was sent'.
      ENDIF.
    ENDFORM.                    " SEND_FILE_AS_EMAIL_ATTACHMENT
    *&      Form  data
          text
    -->  p1        text
    <--  p2        text
    FORM data.
    SELECT SNDPRN
             DOCNUM
             IDOCTP
             MESTYP
             DIRECT
             CREDAT
             STATUS
             FROM EDIDC
             INTO CORRESPONDING FIELDS
             OF TABLE TB_EDIDC
             WHERE STATUS = P_STATUS
             AND MESTYP IN S_MESTYP
             AND DIRECT IN S_DIRECT
             AND CREDAT IN S_CREDAT.
    SELECT KUNNR
           INPNR
           FROM EDPAR
           INTO CORRESPONDING FIELDS
           OF TABLE TB_EDPAR
           FOR ALL ENTRIES IN TB_EDIDC
           WHERE KUNNR = TB_EDIDC-SNDPRN.
    SELECT KUNNR
           ADRNR
           FROM KNA1
           INTO CORRESPONDING FIELDS
           OF TABLE TB_KNA1
           FOR ALL ENTRIES IN TB_EDPAR
           WHERE KUNNR = TB_EDPAR-INPNR.
    SELECT ADDRNUMBER
           BUILDING
           FROM ADRC
           INTO CORRESPONDING FIELDS
           OF TABLE TB_ADRC
           FOR ALL ENTRIES IN TB_KNA1
           WHERE ADDRNUMBER = TB_KNA1-ADRNR.
    LOOP AT TB_EDIDC WHERE STATUS = P_STATUS
                     AND MESTYP IN S_MESTYP
                     AND DIRECT IN S_DIRECT
                     AND CREDAT IN S_CREDAT.
      TB_ED-SNDPRN = TB_EDIDC-SNDPRN.
      TB_ED-DOCNUM = TB_EDIDC-DOCNUM.
      TB_ED-IDOCTP = TB_EDIDC-IDOCTP.
      TB_ED-MESTYP = TB_EDIDC-MESTYP.
      TB_ED-DIRECT = TB_EDIDC-DIRECT.
      TB_ED-CREDAT = TB_EDIDC-CREDAT.
      TB_ED-STATUS = TB_EDIDC-STATUS.
      READ TABLE TB_EDPAR WITH KEY KUNNR = TB_EDIDC-SNDPRN.
      READ TABLE TB_KNA1 WITH KEY KUNNR = TB_EDPAR-INPNR.
      READ TABLE TB_ADRC WITH KEY ADDRNUMBER = TB_KNA1-ADRNR.
      TB_ED-LOC = TB_ADRC-BUILDING.
      APPEND TB_ED.
    ENDLOOP.
    WRITE :/02 'CustomerNo',
            15 'Location Code',
            30 'Idoc Number',
            55 'Basic Type',
            70 'Message Type',
            95 'Direction',
            110 'Received Date',
            130 'Status'.
    ULINE.
    LOOP AT TB_ED.
      WRITE :/02 TB_ED-SNDPRN,
              15 TB_ED-LOC,
              30 TB_ED-DOCNUM,
              55 TB_ED-IDOCTP,
              70 TB_ED-MESTYP,
              95 TB_ED-DIRECT,
              110 TB_ED-CREDAT,
              130 TB_ED-STATUS.
    ENDLOOP.
    ENDFORM.                    " data
    Kindly help me in solving the issue.
    Thanks in advance.
    Suki.

    Hi,
    Check in transaction SCOT. If your mail is in error status in SCOT, you can assure that there is no problem with your code. If your message has not reached till SCOT, then the problem will be with the code.
    If the mail is there in scot with error status tell the BASIS to configure it. I feel this could be the problem.
    Regards,
    Renjith Michael.

  • Uncaught Exception occured while sending mail through abap code.

    Hi,
    Uncaught Exception occured while sending mail through abap code.Run time Errors "UNCAUGHT_EXCEPTION" occured after excuting the call method  CALL METHOD SEND_REQUEST->SEND( ).kindly help in resolving the issue.

    HI,
    Runtime Error:  UNCAUGHT_EXCEPTION details.
    Runtime Errors         UNCAUGHT_EXCEPTION
    Exception              CX_ADDRESS_BCS
    Short text
         An exception occurred that was not caught.
    What happened?
         The exception 'CX_ADDRESS_BCS' was raised, but it was not caught anywhere along
         the call hierarchy.
         Since exceptions represent error situations and this error was not
         adequately responded to, the running ABAP program 'SAPLZSEND_MAIL' has to be
         terminated.
    Error analysis
        An exception occurred that is explained in detail below.
        The exception, which is assigned to class 'CX_ADDRESS_BCS', was not caught in
        procedure "SEND_MAIL" "(FORM)", nor was it propagated by a RAISING clause.
        Since the caller of the procedure could not have anticipated that the
        exception would occur, the current program is terminated.
        The reason for the exception is:
        An exception occurred
    How to correct the error
        If the error occures in a non-modified SAP program, you may be able to
        find an interim solution in an SAP Note.
        If you have access to SAP Notes, carry out a search with the following
        keywords:
        "UNCAUGHT_EXCEPTION" "CX_ADDRESS_BCS"
        "SAPLZSEND_MAIL" or "LZSEND_MAILU01"
        "ZSEND_EMAIL"
        If you cannot solve the problem yourself and want to send an error
        notification to SAP, include the following information:
        1. The description of the current problem (short dump)
           To save the description, choose "System->List->Save->Local File
        (Unconverted)".
        2. Corresponding system log
           Display the system log by calling transaction SM21.
           Restrict the time interval to 10 minutes before and five minutes
        after the short dump. Then choose "System->List->Save->Local File
        (Unconverted)".
        3. If the problem occurs in a problem of your own or a modified SAP
        program: The source code of the program
           In the editor, choose "Utilities->More
        Utilities->Upload/Download->Download".
    4. Details about the conditions under which the error occurred or which
    actions and input led to the error.
    The exception must either be prevented, caught within proedure
    "SEND_MAIL" "(FORM)", or its possible occurrence must be declared in the
    RAISING clause of the procedure.
    Please help me to resolve this issue.

  • Authentication Error while Sending Email from SMTP server.

    Authentication Error while Sending Email from SMTP server.  Can receive emails but cannot send emails from this account. 

    no email account was setup on the phone unless it was issued by your company.
    gmail is required but no server address ports to enter.
    my gmail account was setup before i took delivery of the phone but could have been done when phone was activated.
    i added cox pop3 email and had to manually enter both pop3 and smtp servers with both boxes checked on both servers.
    i doubt if it's a verizon issue.

  • How to set attched file name while sending email through ABAP

    Hi All- tell me how to set attched file name while sending email through ABAP.
    regards...
    Abhay

    Sure,  when you are adding your entry to the packing list,  give the name in the obj_name field.
    *File 2
      mailbin = 'This is file 2'.
      append mailbin.
      data: start type i.
      data: end type i.
      start = tab_lines + 1.
      describe table mailbin lines end.
      mailpack-transf_bin = 'X'.
      mailpack-head_start = 1.
      mailpack-head_num = 1.
      mailpack-body_start = start.
      mailpack-body_num = end.
      mailpack-doc_type = 'TXT'.
      mailpack-obj_name = 'TEST2'.        "<-  RIGHT HERE
      mailpack-obj_descr = 'Subject'.
      mailpack-doc_size = tab_lines * 255.
      append mailpack.
    Regards,
    RIch Heilman

  • Error while sending emails from SOA 11G BPEL

    Hi All,
    I have configured an error email in my catch/catch-all blocks. Incase I dont have any retry action in my faultpolicies.xml file, the error email is sent fine. However if any remote/binding fault occurs and retry is done on partnerlink, in those cases the Error Notification service fails with below error:
    ORABPEL-31015
    Error while sending notification.
    Error while sending notification to email.
    Possible causes : SDPMessaging Driver not configured; Invalid To Address is used; Email server/Messaging gateway is down; using IP address as part of email ID instead of domain name;.
    Caused by: javax.naming.NameNotFoundException: While trying to look up comp/env/ejb/services/NotificationServiceBean in /app/ejb/ejb_ob_engine_wls.jar#BPELActivityManagerBean.; remaining name 'comp/env/ejb/services/NotificationServiceBean'
    sendEmailNotification WSIF Exception occured. Please check stack trace "Cannot get Object part 'Responses'. No parts are set on the message"
    If I throw a remote/binding fault (throw activity), the error email gets sent. However whenever the retry happens incase of a fault, the above error comes.
    Any idea what can be reason behing this...
    Regards
    Subhankar

    try to call a sub process from your catch all block and use the email activity in that subprocess. this should work

  • How to send emails using java code

    Hi,
    can any give me some sample code for sending emails using java language

    JavaMail quick start
    jGuru: Fundamentals of the JavaMail API

  • Sending Email using java code

    I am using the following code to send an email from my java servlet but the problem is, when it is on its own it works fine but as soon as I combine it with some code to submit data into a postgres database it sometimes does not perform could it be because im missing some close statements??
    //grades to submit grades starts here
                                                           String [] paramValues = req.getParameterValues("Mark");
                                                      for(int i=0; i<paramValues.length;i++)
                                                           String [] paramValues2 = req.getParameterValues("StudentExamNumber");
                                                                String Mark = paramValues;
                                                                String ExamNo = paramValues2[i];
                                                                //testing purposes
                                                                out.println("<tr><td>"+ExamNo+"</td>");
                                                                out.println("<td>"+Mark+"</td>");
                                                                try
                                                           st = conn.createStatement();
                                                           query = "SELECT StudentNo FROM STUDENTS"+WebCourse2+ " where ExamNo='"+ExamNo+"'";
                                                           rs = st.executeQuery(query);
                                                           if(rs !=null)
                                                                          while(rs.next())
                                                                               String StudentNo=rs.getString("StudentNo");
                                                                               //testing purposes
                                                                               //out.println("<td>"+StudentNo+"</td></tr>");
                                                                               here
                                                                               st4 = conn.createStatement();
                                                                     query4 = "select MAX(entryno) from STUDENTRESULTSFORCOURSE"+WebCourse2+" WHERE STUDENTNO='"+StudentNo+"'";
                                                                     rs4 = st4.executeQuery(query4);
                                                                     if(rs4 !=null)
                                                                                    while(rs4.next())
                                                                                         EntryNo = rs4.getInt(1);
                                                                                    }//end rs4 while
                                                                                    rs4.close();
                                                                               }//end rs4 if
                                                                     out.println("<tr><td>EntryNo= "+EntryNo+"</td>");
                                                                               EntryNo = EntryNo + 1;
                                                                               out.println("<td>NewEntryNo= "+EntryNo+"</td></tr>");
                                                                               //Submitting grades to database/
                                                                     st3 = conn.createStatement();
                                                                     insert = "insert into STUDENTRESULTSFORCOURSE"+WebCourse2+" (StudentNo, CourseCode, AttemptNo, ExamMark, EntryNo, EnteredBy) values ('"+StudentNo+"', '"+WebCourse2+"', 1,'"+Mark+"',"+EntryNo+",'"+WebUsername2+"')";
                                                                     st3.executeUpdate(insert);
                                                                          }//end rs while
                                                                          rs.close();
                                                                     }//end rs if
                                                                }//end try
                                                                catch (SQLException e)
                                                                     System.out.println("Error: "+e.getMessage());
                                                           }//end for loop     
                                                           //code to submit grades ends here
                                                           //code used to send email starts here
                                                           String m_sHostName="localhost";
                                                      int m_iPort=25;
                                                           try
                                                                // Open port to server
                                                                smtpSocket = new Socket(m_sHostName, m_iPort);
                                                                os = new DataOutputStream(smtpSocket.getOutputStream());
                                                                is = new DataInputStream(smtpSocket.getInputStream());
                                                                if(smtpSocket != null && os != null && is != null)
                                                                     // Connection was made. Socket is ready for use.
                                                                     System.out.println("Connection was made. Socket is ready for use.");
                                                                     try
                                                                          // The email address that the server
                                                                          // you are using know user as.
                                                                          os.writeBytes("MAIL From: <[email protected]>\r\n");
                                                                          // Who the email is going to.
                                                                          os.writeBytes("RCPT To: <[email protected]>\r\n");
                                                                          //send a CC to:
                                                                          os.writeBytes("RCPT Cc: <[email protected]>\r\n");
                                                                          // add the message and the
                                                                          // header of the email to be sent out.
                                                                          os.writeBytes("DATA\r\n");
                                                                          os.writeBytes("X-Mailer: Via Java\r\n");
                                                                          os.writeBytes("From: "+WebUsername2+"<[email protected]>\r\n");
                                                                          os.writeBytes("To: Marie <[email protected]>\r\n");
                                                                          //Again if you want to send a CC then add this.
                                                                          os.writeBytes("Cc: ProfCuthbert <[email protected]>\r\n");
                                                                          String sMessage = "ELECTRONIC ENGINEERING EXAM COLLATION SYSTEM EMAIL\n\nThe results for the following course have been submitted by the following member of staff\n\nCOURSE: "+WebCourse2+"\n\nSUBMITTED BY: "+WebUsername2+" \n\nPLEASE LOCK COURSE NOW IN ORDER TO PREVENT ANY FURTHER SUBMISSIONS TO BE MADE BY USERS.";
                                                                          os.writeBytes("Subject: A SUBMISSION HAS BEEN MADE FOR COURSE "+WebCourse2+"\r\n");
                                                                          os.writeBytes(sMessage + "\r\n");
                                                                          os.writeBytes("\r\n.\r\n");
                                                                          os.writeBytes("QUIT\r\n");
                                                                          // Now send the email off and check the server reply.
                                                                          // Once an OK is reached you are complete.
                                                                          String responseline;
                                                                          //for testing purposes
                                                                          //out.println(responseline = is.readLine());
                                                                          while((responseline = is.readLine())!=null)
                                                                          //for testing purposes
                                                                          //out.println("responseline= "+responseline+"<br>");
                                                                          //out.println("responseline.indexOf(Ok)= "+responseline.indexOf("Ok"));
                                                                          if(responseline.indexOf("Ok") != -1)
                                                                          break;
                                                                          if(responseline.indexOf("Ok") == -1)
                                                                          confirm=1;
                                                                          if (confirm==1)
                                                                          out.println("<br>the marks have been submitted thank you");
                                                                          catch(Exception e)
                                                                          {  System.out.println("Cannot send email as an error occurred.");
                                                                               out.println("Cannot send email as an error occurred.");
                                                           catch(Exception e)
                                                           { System.out.println("Host " + m_sHostName + "unknown"); }
    Does anyone know what the problem is??
    thanks
    tzaf

    i close them later in the program. Ive made sure they are all closed I have a feeling that it could be coming from here....
    //code used to send email starts here
                                                           String m_sHostName="localhost";
                                                      int m_iPort=25;
                                                           try
                                                                // Open port to server
                                                                smtpSocket = new Socket(m_sHostName, m_iPort);
                                                                os = new DataOutputStream(smtpSocket.getOutputStream());
                                                                is = new DataInputStream(smtpSocket.getInputStream());
                                                                if(smtpSocket != null && os != null && is != null)
                                                                     // Connection was made. Socket is ready for use.
                                                                     System.out.println("Connection was made. Socket is ready for use.");
                                                                     try
                                                                          // The email address that the server
                                                                          // you are using know user as.
                                                                          os.writeBytes("MAIL From: <email address>\r\n");
                                                                          // Who the email is going to.
                                                                          os.writeBytes("RCPT To: <email address>\r\n");
                                                                          //send a CC to:
                                                                          os.writeBytes("RCPT Cc: <email address>\r\n");
                                                                          // add the message and the
                                                                          // header of the email to be sent out.
                                                                          os.writeBytes("DATA\r\n");
                                                                          os.writeBytes("X-Mailer: Via Java\r\n");
                                                                          os.writeBytes("From: "+WebUsername2+"<email address>\r\n");
                                                                          os.writeBytes("To: hello<email address>\r\n");
                                                                          //Again if you want to send a CC then add this.
                                                                          os.writeBytes("Cc: hello <email address>\r\n");
                                                                          String sMessage = "ELECTRONIC ENGINEERING EXAM COLLATION SYSTEM EMAIL\n\nThe results for the following course have been submitted by the following member of staff\n\nCOURSE: "+WebCourse2+"\n\nSUBMITTED BY: "+WebUsername2+" \n\nPLEASE LOCK COURSE NOW IN ORDER TO PREVENT ANY FURTHER SUBMISSIONS TO BE MADE BY USERS.";
                                                                          os.writeBytes("Subject: A SUBMISSION HAS BEEN MADE FOR COURSE "+WebCourse2+"\r\n");
                                                                          os.writeBytes(sMessage + "\r\n");
                                                                          os.writeBytes("\r\n.\r\n");
                                                                          os.writeBytes("QUIT\r\n");
                                                                          // Now send the email off and check the server reply.
                                                                          // Once an OK is reached you are complete.
                                                                          String responseline;
                                                                          //for testing purposes
                                                                          //out.println(responseline = is.readLine());
                                                                          while((responseline = is.readLine())!=null)
                                                                          //for testing purposes
                                                                          //out.println("responseline= "+responseline+"<br>");
                                                                          //out.println("responseline.indexOf(Ok)= "+responseline.indexOf("Ok"));
                                                                          if(responseline.indexOf("Ok") != -1)
                                                                          break;
                                                                          if(responseline.indexOf("Ok") == -1)
                                                                          confirm=1;
                                                                          if (confirm==1)
                                                                          out.println("<br>the marks have been submitted thank you");
                                                                          catch(Exception e)
                                                                          {  System.out.println("Cannot send email as an error occurred.");
                                                                               out.println("Cannot send email as an error occurred.");
                                                           catch(Exception e)
                                                           { System.out.println("Host " + m_sHostName + "unknown"); }
                                                           //code used to send email ends here
    do i need to close is and os?
    thanks
    tzaf

  • Can anybody help on sending mail through Java Code

    I am trying to send the mail using the java code and I am unable to do it. My code is
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import java.text.*;
    public class EmailExample {
    public static void main(String[] args)
    Socket smtpSocket;
    DataOutputStream os;
    BufferedReader is;
    Date dDate = new Date();
    DateFormat dFormat = DateFormat.getDateInstance(DateFormat.FULL,Locale.US);
    try
    smtpSocket = new Socket("www.gmail.com",80);
    os = new DataOutputStream(smtpSocket.getOutputStream());
    is = new BufferedReader(new InputStreamReader(smtpSocket.getInputStream()));
    System.out.println("Hi How is this?");
    os.writeBytes("HELLO\r\n");
    // You will add the email address that the server
    // you are using know you as.
    os.writeBytes("MAIL From: <[email protected]>\r\n");
    // Who the email is going to.
    os.writeBytes("RCPT To: <[email protected]>\r\n");
    //IF you want to send a CC then you will have to add this
    //os.writeBytes("RCPT Cc: <[email protected]>\r\n");
    // Now we are ready to add the message and the
    // header of the email to be sent out.
    os.writeBytes("DATA\r\n");
    os.writeBytes("X-Mailer: Via Java\r\n");
    os.writeBytes("DATE: " + dFormat.format(dDate) + "\r\n");
    System.out.println("DATE: " + dFormat.format(dDate) + "\r\n");
    os.writeBytes("From: Me <[email protected]>\r\n");
    os.writeBytes("To: YOU <[email protected]>\r\n");
    //Again if you want to send a CC then add this.
    //os.writeBytes("Cc: CCDUDE <[email protected]>\r\n");
    //Here you can now add a BCC to the message as well
    //os.writeBytes("RCPT Bcc: BCCDude<[email protected]>\r\n");
    String sMessage = "Your subjectline here";
    os.writeBytes("Subject: Your subjectline here\r\n");
    os.writeBytes(sMessage + "\r\n");
    os.writeBytes("\r\n.\r\n");
    os.writeBytes("QUIT\r\n");
    // Now send the email off and check the server reply.
    // Was an OK is reached you are complete.
    String responseline;
    while((responseline = is.readLine())!=null)
    {   System.out.println(responseline);
    if(responseline.indexOf("Ok") != -1)
    break;
    } catch (IOException e) {
    e.printStackTrace();
    It is compiling and runnung properly. Please Help me on this.
    Thanks.
    Satya.

    You're mishandling the responses. You terminate if you don't get an "Ok" string, but that's not how success is defined - you should get a 200 code back, typically with an "OK" (not caps) message.
    It doesn't help that you're ignoring all of the server output after each command, so you never find out if anything goes wrong.
    You're also reinventing a wheel. The JavaMail API exists for this: http://java.sun.com/products/javamail/

  • Error while sending email from MOSS portal

    Hi,
    I have configured email settings on my MOSS central admin, still MOSS throws error while trying to send emails to AD users. I tried to give permission for a user in a site and it threw this error:
    The user or users have been added successfully, but there was an error in sending the e-mail message. The server may not be set up correctly to send e-mail. To verify that e-mail is configured correctly, contact your server administrator.   at Microsoft.SharePoint.ApplicationPages.AclInv.SendEmailInvitation(PeopleEditor picker, String subject, String message)
       at Microsoft.SharePoint.ApplicationPages.AclInv.BtnOK_Click(Object sender, EventArgs e)
       at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
       at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
       at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
       at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
       at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    I have provided outbound smtp server address and the email addresses as well.
    Regards,
    Manoj

    Ok, issue solved!!  The issue was that I had to set anonymous connection directly to server. Error provided by SharePoint didn't help at all. After hours of hair-pulling and head-banging, I found a nice article that detailed how to troubleshoot e-mail issues:
    http://www.tonytestasworld.com/post/2009/04/09/SharePoint-2007-Outgoing-E-mail-Troubleshooting-Tips.aspx
    In the above article, the troubleshooting step 5 was the breaking point. As suggested in the blog:
    http://www.sharepointblogs.com/johnwpowell/archive/2007/07/10/alerts-failing-cannot-connect-to-smtp-host.aspx
    I created a C# console application and it gave me the correct error:
    The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Client was not authenticated
    So I used this code to create an SMTP test application:
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Net.Mail;
    public class Program
    public static void Main(string[] args)
    try
    // Check arguments
    if (args.Length != 3)
    ShowUsage();
    return;
    // Create message
    MailMessage mmMessage = new MailMessage();
    mmMessage.To.Add(new MailAddress(args[2] as string));
    mmMessage.From = new MailAddress(args[1] as string);
    mmMessage.Subject = "TestMail";
    mmMessage.Body = "This is a test";
    // Send message
    SmtpClient sc = new SmtpClient(args[0] as string);
    sc.Send(mmMessage);
    catch (Exception ex)
    Console.WriteLine(ex);
    finally
    //Pause
    Console.WriteLine();
    Console.Write("Press a key >");
    Console.ReadKey();
    private static void ShowUsage()
    Console.WriteLine("Usage");
    Console.WriteLine("TestMail [SmtpServer] [FromAddress] [ToAddress]");
    } // end Program
    This command saved lots of trouble for me and solved the email issue:
    http://forums.msexchange.org/m_1800412705/mpage_1/key_/tm.htm
    set-ReceiveConnector "default sfzcombx" -permissiongroups:"ExchangeUsers,ExchangeServers,ExchangeLegacyServers,AnonymousUsers"
    Hope this helps somebody!
    Regards,
    Manoj

  • Error while sending email to distribution list

    Hello All,
    I am not able to send the email to Shared & Private distribution list.
    It is giving an error "Function <Send> not possible"
    I can send the email to users by specyfying their email id & recepient type as Internet address while sending mail from the Business Workplace. But we want to send it to users in shared/private distribution list.
    SCOT, SMTP are properly configured as per SAP Note 455140.
    Interestingly Routing Test in the SAPConnect shows no errors. Also the internal  traces are enabled, but it shows nothing for the outbound traces.
    Response starting with "220", in the telnet results (for both SAP server & Exchange server) confirms that the SCOT configuration is correct for Mail Host & Mail Port.
    We are on ECC6 on Oracle 10g & Windows.
    I have searched this forum but couldnot find relevant answer.
    If anybody has faced such problem, let me know how to resolve this.
    Regards,
    Vivdha

    Hi,
    Check in transaction SCOT. If your mail is in error status in SCOT, you can assure that there is no problem with your code. If your message has not reached till SCOT, then the problem will be with the code.
    If the mail is there in scot with error status tell the BASIS to configure it. I feel this could be the problem.
    Regards,
    Renjith Michael.

  • Reg : Problem in Sending Mail Through Java Code

    Hi All,
    I wrote java code to send email to gmail. But am getting the error as following .
    Error:
    C:\jdevstudio10134\jdk\bin\javaw.exe -client -classpath "C:\jdevstudio10134\jdev\mywork\Prasad\Project1\classes;C:\Program Files\Java\jre1.5.0_14\lib\j2ee.jar" tips.mails.SendMailTest
    javax.mail.SendFailedException: Sending failed;
    nested exception is:
         class javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 995
         at javax.mail.Transport.send0(Transport.java:218)
         at javax.mail.Transport.send(Transport.java:80)
         at tips.mails.SendMail.send(SendMail.java:53)
         at tips.mails.SendMailTest.main(SendMailTest.java:13)
    Process exited with exit code 0.
    Class :
    package tips.mails;
    import java.util.Properties;
    import javax.mail.Message;
    import javax.mail.MessagingException;
    import javax.mail.Session;
    import javax.mail.Transport;
    import javax.mail.Message.RecipientType;
    import javax.mail.internet.AddressException;
    import javax.mail.internet.InternetAddress;
    import javax.mail.internet.MimeMessage;
    public class SendMail {
         private String from;
         private String to;
         private String subject;
         private String text;
         public SendMail(String from, String to, String subject, String text){
              this.from = from;
              this.to = to;
              this.subject = subject;
              this.text = text;
         public void send(){
              Properties props = new Properties();
              props.put("mail.smtp.host", "smtp.gmail.com");
              props.put("mail.smtp.port", "995");
              Session mailSession = Session.getDefaultInstance(props);
              Message simpleMessage = new MimeMessage(mailSession);
              InternetAddress fromAddress = null;
              InternetAddress toAddress = null;
              try {
                   fromAddress = new InternetAddress(from);
                   toAddress = new InternetAddress(to);
              } catch (AddressException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              try {
                   simpleMessage.setFrom(fromAddress);
                   simpleMessage.setRecipient(RecipientType.TO, toAddress);
                   simpleMessage.setSubject(subject);
                   simpleMessage.setText(text);
                   Transport.send(simpleMessage);               
              } catch (MessagingException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
    ==============================================================================
    Main Class :
    package tips.mails;
    public class SendMailTest {
         public static void main(String[] args) {
              String from = "[email protected]";
              String to = "[email protected]";
              String subject = "Hi Rekha";
              String message = "A test message";
              SendMail sendMail = new SendMail(from, to, subject, message);
              sendMail.send();
    ========================
    Please help me on this .
    Thanks in Advance.

    Hi,
    smtp.gmail.com port is : 587/465
    pop.gmail.com port is : 995
    if u r using ssl connection then use port 465 for smtp.gmail.com. if u r using non-ssl connection means TLS type then u should use port 587 for smtp.gmail.com.
    For any further assistance u can refer to this forum - http://forums.sun.com/forum.jspa?forumID=43 assuming u r using javamail api.

  • Error while sending mail through SMTP

    Hi,
      We are getting the following error while trying to send mail through SMTP.
    '554 ERROR_MESSAGE_STATE: SMTP_NO_HANDLER( host:1-,subrc:0001)'
    Please advice,
    Regards,
    Sam

    Hi All,
      Configured SMTP as per the note 455140,i can able to send mails from SAP to the out side world,
    mails in SAP.When i tried the test to check whether the SAP system is correctly set up to receive e-mails as per the note 607108, iam getting a connection closed message as below.                                                                           
    afgdev:pgdadm> telnet afgdev 2500                                          
    Trying...                                                                  
    Connected to afgdev.                                                       
    Escape character is '^]'.                                                  
    220 afgdev.abc.ae SAP 6.40(52) ESMTP service ready                   
    helo afgdev                                                                
    250 afgdev.abc.ae                                                    
    mail from:<[email protected]>                                      
    250 Ok                                                                     
    rcpt to:<[email protected]>                                 
    250 Ok                                                                     
    data                                                                       
    354 Enter mail, end with "."                                               
    Hello,This is a test.                                                      
    Connection closed.                                                         
    afgdev:pgdadm> 
    rgds
    Sam

Maybe you are looking for