Topic
6 replies Latest Post - ‏2013-12-05T16:52:29Z by melshah
melshah
melshah
70 Posts
ACCEPTED ANSWER

Pinned topic Email notification from code

‏2013-11-19T22:11:21Z |

Hello,

Suddenly the email notification from the code within the schema which fires on action Assing and Complete is not working

I tried manually sending the email via telnet command and it worked fine

Schema properties for windows is BASIC

I put debug statement in the code and When the action is performed i see that  debug statement so atleast it comes in the function

Any help on why it would not send out an notification how do we debug the issue

The only change that happen was  the schema properties was changed to PERL as we wanted to change the code from vb to perl but later on again we changed back to BASIC

 

Sub Defect_Notification(actionname, actiontype)
  ' actionname As String
  ' actiontype As Long
  ' action is Assign
  ' record type name is Vision


set sessionObj = GetSession
sessionObj.OutputDebugString " Sending notification for Assigned."


IF ( GetFieldValue("Submitter").GetValue() = "LUDO") Then
DIM subject_string
DIM body_string
DIM session
DIM current_user_fullname
set session = GetSession

    Set mailmsg = CreateObject("PAINET.MAILMSG")
    current_user_fullname = session.GetUserFullName()
    My_Format_Str = GetFieldValue("headline").GetValue()
    I = InStrRev("-", My_Format_Str)
    Request_Number = Right(My_Format_Str, Len(My_Format_Str) - I)
    subject_string = GetFieldValue("headline").GetValue() & "- - Request# " & Request_Number
    ' you may add any text in the email body
    
    Headline_Length = Len(My_Format_Str)
    Last_hyphen_pos = InStrRev(My_Format_Str, "-", -1)
    offset = Headline_Length - Last_hyphen_pos
    Req_num = Right(My_Format_Str, offset)
    subject_string = GetFieldValue("headline").GetValue() & " - Request# " & Req_num
    
    body_string = "Headline: " & GetFieldValue("headline").GetValue() & vbCrLf &_
    "id:" & GetFieldValue("id").GetValue() & vbCrLf &_
    "State:" & GetFieldValue("State").GetValue() & vbCrLf &_
    "Functional areas:" & GetFieldValue("Functional_areas").GetValue() & vbCrLf &_
    "Note to OIS User:" & GetFieldValue("Note_to_OIS_User").GetValue() & vbCrLf &_
    "Note to Tier1:" & GetFieldValue("Note_to_Tier1").GetValue() & vbCrLf &_
    "Description:" & GetFieldValue("Description").GetValue() & vbCrLf & vbCrLf &_
    current_user_fullname & vbCrLf &_
    "has assigned this Vision."  
    
    '' email to Submiter'
    ' if your submitter field is a reference field
    ' mailmsg.AddTo GetFieldValue("Submitter.email").GetValue()
    ' else if is login name
    Set userobj = session.GetEntity("users", GetFieldValue("Submitter").GetValue() )
    mailmsg.AddTo userobj.GetFieldValue("email").GetValue()
    mailmsg.SetSubject subject_string
    mailmsg.MoreBody body_string
    mailmsg.Deliver

 END IF

    REM Post-commit notifications about actions may be handled here
End Sub

  • CQAdmin
    CQAdmin
    103 Posts
    ACCEPTED ANSWER

    Re: Email notification from code

    ‏2013-11-20T03:37:44Z  in response to melshah

    Hi,

    Your code is working fine...I used the same code in my test setup. I am getting emails.

    Things you can check now-

    1. In clearQuest client if you have correct settings for "Email Options". Go to View -> E-mail Options

    Make sure, Enable E-mail notification is Checked and E-mail provider is SMTP

    and then you have correct configuration for "Outgoing SMTP Server"

    2. If you are using a new TEST database to test this, by default the Email Options settings are blank. You have to configure it.

    3. Make sure the user LUDO has his Full Name and a valid email id in CQ User Admin tool.

     

    Please check this and update me on this.

    For sure, there is no issue with your code. it is working fine.

    :-)

    Updated on 2013-11-20T05:01:27Z at 2013-11-20T05:01:27Z by CQAdmin
  • melshah
    melshah
    70 Posts
    ACCEPTED ANSWER

    Re: Email notification from code

    ‏2013-11-20T15:33:03Z  in response to melshah

    I did capture the log and here is the issue i see

    [CQ 98.484, 20131119, 22:30:52, 3368, 3472, 5637] Email Rules (painetlib.dll): Delivering a SMTP message
    [CQ 98.484, 20131119, 22:30:52, 3368, 3472, 5638] Email Rules (painetlib.dll): To: <hd@support.helpdesk.com>
    [CQ 98.484, 20131119, 22:30:52, 3368, 3472, 5639] Email Rules (painetlib.dll): Cc:
    [CQ 98.484, 20131119, 22:30:52, 3368, 3472, 5640] Email Rules (painetlib.dll): Bcc:
    [CQ 98.484, 20131119, 22:30:52, 3368, 3472, 5641] socketbuf (cqinetlib.dll): connect succeeded
    [CQ 98.531, 20131119, 22:30:52, 3368, 3472, 5642] smtpclient (cqinetlib.dll): SMTP<-220 mail.cossystem.com ESMTP Sendmail 8.14.4+Sun/8.13.8; Tue, 19 Nov 2013 22:59:16 -0500 (EST)
    [CQ 98.531, 20131119, 22:30:52, 3368, 3472, 5643] smtpclient (cqinetlib.dll): SMTP->EHLO localhost
    [CQ 98.531, 20131119, 22:30:52, 3368, 3472, 5644] smtpclient (cqinetlib.dll): SMTP<-250-mail.cossystem.com Hello fm-dw-01.cossystem.com [192.168.30.25], pleased to meet you
    [CQ 98.531, 20131119, 22:30:52, 3368, 3472, 5645] smtpclient (cqinetlib.dll): SMTP<-250-ENHANCEDSTATUSCODES
    [CQ 98.531, 20131119, 22:30:52, 3368, 3472, 5646] smtpclient (cqinetlib.dll): SMTP<-250-PIPELINING
    [CQ 98.531, 20131119, 22:30:52, 3368, 3472, 5647] smtpclient (cqinetlib.dll): SMTP<-250-EXPN
    [CQ 98.531, 20131119, 22:30:52, 3368, 3472, 5648] smtpclient (cqinetlib.dll): SMTP<-250-VERB
    [CQ 98.531, 20131119, 22:30:52, 3368, 3472, 5649] smtpclient (cqinetlib.dll): SMTP<-250-8BITMIME
    [CQ 98.531, 20131119, 22:30:52, 3368, 3472, 5650] smtpclient (cqinetlib.dll): SMTP<-250-SIZE
    [CQ 98.531, 20131119, 22:30:52, 3368, 3472, 5651] smtpclient (cqinetlib.dll): SMTP<-250-DSN
    [CQ 98.531, 20131119, 22:30:52, 3368, 3472, 5652] smtpclient (cqinetlib.dll): SMTP<-250-ETRN
    [CQ 98.531, 20131119, 22:30:52, 3368, 3472, 5653] smtpclient (cqinetlib.dll): SMTP<-250-DELIVERBY
    [CQ 98.531, 20131119, 22:30:52, 3368, 3472, 5654] smtpclient (cqinetlib.dll): SMTP<-250 HELP
    [CQ 98.531, 20131119, 22:30:52, 3368, 3472, 5655] smtpclient (cqinetlib.dll): SMTP->MAIL FROM:<CQ Server>
    [CQ 98.531, 20131119, 22:30:52, 3368, 3472, 5656] smtpclient (cqinetlib.dll): SMTP<-553 5.5.4 <CQ Server>... Domain name required for sender address CQ.Server
    [CQ 98.531, 20131119, 22:30:52, 3368, 3472, 5657] API: call OAdSession(1F2CE00)::OnFinalRelease ()
    [CQ 98.531, 20131119, 22:30:52, 3368, 3472, 5658] API: dest OAdSession(1F2CE00)

    ===================================================

    i tried to login  with the from account on solaris mailserver box

    $ telnet localhost 25
    Trying localhost..
    Connected to 192.168.10.100.
    Escape character is '^]'.
    220 mail.cossystem.com ESMTP Sendmail 8.14.4+Sun/8.13.8; Wed, 20 Nov 2013 10:13:58 -0500 (EST)
    helo
    501 5.0.0 helo requires domain address
     

    • MartinThompson
      MartinThompson
      4 Posts
      ACCEPTED ANSWER

      Re: Email notification from code

      ‏2013-11-20T16:10:41Z  in response to melshah

      It looks to me like the MAIL FROM field does not contain a valid email address. Fix that and it should work.

      • melshah
        melshah
        70 Posts
        ACCEPTED ANSWER

        Re: Email notification from code

        ‏2013-11-20T16:29:23Z  in response to MartinThompson

        yes

        1. In clearQuest client settings for "Email Options". Go to View -> E-mail Options

        your qualified email name was just a string  " CQ Server"  changed this to the qualified email address and  i see the mails accepted for delivery in the mail server logs

        -Sagar

    • GlennSkinner
      GlennSkinner
      58 Posts
      ACCEPTED ANSWER

      Re: Email notification from code

      ‏2013-11-20T16:38:27Z  in response to melshah

      Is the "CQ Server" a cqweb server? The server is identifying itself as "localhost" not the fully qualified name. See this line:

      [CQ 98.531, 20131119, 22:30:52, 3368, 3472, 5643] smtpclient (cqinetlib.dll): SMTP->EHLO localhost
       

      If you are using cqweb, check the cqserverconn.properties file. If the server is defined as localhost, change it to the fully qualified name and see if that makes a difference. From what you posted, my best guess would be that the "localhost" dns information has been removed from the hosts file on the smtp server. The smtp server cannot resolve localhost to an IP address.

      • melshah
        melshah
        70 Posts
        ACCEPTED ANSWER

        Re: Email notification from code

        ‏2013-12-05T16:52:29Z  in response to GlennSkinner

        Yes  the issue was from CQ webserver and also the thick client

        The values of  qualified email name was not correct once corrected it worked fine from both web and desktop client

         

        -Sagar