Menu

#59 changing from

v1.0 (example)
closed
nobody
None
5
2022-03-12
2021-10-29
No

Hey,

I tried to use the set from filter but its not working, if i dont use it, it will come up with sendasdenied in log file.
When i use filter this is the input in log file, can you see what is wrong?

I have replaced some info in the text under

emailrelay: 20211029.120344.849: info: smtp connection from 127.0.0.1:51659
emailrelay: 20211029.120344.849: info: tx>>: "220 Integr01-test.ourdomain.com -- E-MailRelay V2.2 -- Service ready"
emailrelay: 20211029.120344.852: info: rx<<: "EHLO Integr01-test.ourdomain.com"
emailrelay: 20211029.120344.852: info: tx>>: "250-Integr01-test.ourdomain.com says hello\r\n250-VRFY\r\n250 8BITMIME"
emailrelay: 20211029.120344.854: info: rx<<: "MAIL FROM:name.surname@someotherdomain.com"
emailrelay: 20211029.120344.855: info: content file: C:\ProgramData\E-MailRelay\spool\emailrelay.2348.1635500340.8.content
emailrelay: 20211029.120344.855: info: tx>>: "250 OK"
emailrelay: 20211029.120344.856: info: rx<<: "RCPT TO:post@ourdomain.com"
emailrelay: 20211029.120344.856: info: tx>>: "250 OK"
emailrelay: 20211029.120344.856: info: rx<<: "DATA"
emailrelay: 20211029.120344.857: info: tx>>: "354 start mail input -- end with <crlf>.<crlf>"
emailrelay: 20211029.120344.858: info: rx<<: [message content not logged]
emailrelay: 20211029.120344.858: info: rx<<: "."
emailrelay: 20211029.120344.859: info: envelope file: C:\ProgramData\E-MailRelay\spool\emailrelay.2348.1635500340.8.envelope.new
emailrelay: 20211029.120344.860: info: filter start: [C:\ProgramData\E-MailRelay\emailrelay-filter.js] [C:\ProgramData\E-MailRelay\spool\emailrelay.2348.1635500340.8.content]
emailrelay: 20211029.120344.861: info: filter: running [C:\Windows\system32\cscript.exe] [//nologo] [//B] [C:\ProgramData\E-MailRelay\emailrelay-filter.js] [C:\ProgramData\E-MailRelay\spool\emailrelay.2348.1635500340.8.content] [C:\ProgramData\E-MailRelay\spool\emailrelay.2348.1635500340.8.envelope.new]
emailrelay: 20211029.120345.133: warning: filter failed: exit code 1: [rejected]
emailrelay: 20211029.120345.134: info: filter done: ok=0 response=[rejected]
emailrelay: 20211029.120345.134: info: rejected by filter: [rejected]
emailrelay: 20211029.120345.135: info: tx>>: "452 rejected"
emailrelay: 20211029.120345.135: info: rx<<: "RSET"
emailrelay: 20211029.120345.136: info: tx>>: "250 state reset"
emailrelay: 20211029.120345.136: info: rx<<: "QUIT"
emailrelay: 20211029.120345.136: info: tx>>: "221 OK"
emailrelay: 20211029.120345.137: info: smtp connection closed: smtp protocol done: 127.0.0.1:51659
emailrelay: 20211029.120345.137: info: forwarding: [client disconnect]
emailrelay: 20211029.120345.138: info: forwarding: no messages to send</crlf></crlf>

Related

Support Requests: #59

Discussion

  • Graeme Walker

    Graeme Walker - 2021-10-29

    There is something wrong with the script, but I can't tell you what by looking at the log file.

    The script is terminating with an exit value of 1 which causes the message submission to be failed, and the "response=(rejected)" indicates that the script produced no output on stdout.

    You can test the script by running it manually from the command-line (start->run->cmd.exe then "cd c:\programdata\e-mailrelay" and "cscript /nologo emailrelay-filter.js spool\emailrelay.2348.1635500340.8..content"). Don't use "/B" so if there is a syntax error or something then you should get a helpful message box.

    You can add diagnostics that will show up when you run the script manually by writing to stdout like this:

        WScript.StdOut.WriteLine("got here")
    
     
    • Per Arne Christensen

      Hi

      Thanks for helping me, im not good on this js 😊

      This was the output in cmd window

      c:\ProgramData\E-MailRelay>cscript /nologo emailrelay-filter.js spool\emailrelay.5112.1635491388.5.content
      c:\ProgramData\E-MailRelay\emailrelay-filter.js(173, 1) Microsoft JScript compilation error: Expected '('

      Here is the whole file

      //
      // Copyright (C) 2001-2021 Graeme Walker graeme_walker@users.sourceforge.net<mailto:graeme_walker@users.sourceforge.net>
      //
      // Copying and distribution of this file, with or without modification,
      // are permitted in any medium without royalty provided the copyright
      // notice and this notice are preserved.  This file is offered as-is,
      // without any warranty.
      // ===
      //
      // emailrelay-set-from.js
      //
      // An example "--filter" script that edits the content originator fields
      // (ie. From, Sender and Reply-To) to a fixed value.
      //
      // See also: emailrelay-set-from.pl, RFC-2822
      //
      try
      {
                      var new_from = 'sa-no-reply@kulturtanken.no' ;
                      var new_sender = '' ;
                      var new_reply_to = new_from ;
      
                      var content = WScript.Arguments( 0 ) ;
                      var fs = WScript.CreateObject( "Scripting.FileSystemObject" ) ;
                      var in_ = fs.OpenTextFile( content , 1 , false ) ;
                      var out_ = fs.OpenTextFile( content + ".tmp" , 8 , true ) ;
      
                      var re_from = /^From:/i ;
                      var re_sender = /^Sender:/i ;
                      var re_reply_to = /^Reply-To:/i ;
                      var re_fold = /^[ \t]/ ;
      
                      var in_edit = 0 ;
                      while( !in_.AtEndOfStream )
                      {
                                     var line = in_.ReadLine() ;
                                     if( line === "" )
                                     {
                                                     out_.WriteLine( line ) ;
                                                     break ;
                                     }
      
                                     if( line.match(re_from) && new_from !== null )
                                     {
                                                     in_edit = 1 ;
                                                     line = "From: " + new_from ;
                                                     out_.WriteLine( line ) ;
                                     }
                                     else if( line.match(re_sender) && new_sender !== null )
                                     {
                                                     in_edit = 1 ;
                                                     line = "Sender: " + new_sender ;
                                                     if( new_sender !== "" )
                                                     {
                                                                     out_.WriteLine( line ) ;
                                                     }
                                     }
                                     else if( line.match(re_reply_to) && new_reply_to !== null )
                                     {
                                                     in_edit = 1 ;
                                                     line = "Reply-To: " + new_reply_to ;
                                                     out_.WriteLine( line ) ;
                                     }
                                     else if( in_edit && line.match(re_fold) )
                                     {
                                     }
                                     else
                                     {
                                                     in_edit = 0 ;
                                                     out_.WriteLine( line ) ;
                                     }
                      }
                      while( !in_.AtEndOfStream )
                      {
                                     var body_line = in_.ReadLine() ;
                                     out_.WriteLine( body_line ) ;
                      }
      
                      in_.Close() ;
                      out_.Close() ;
                      fs.DeleteFile( content ) ;
                      fs.MoveFile( content + ".tmp" , content ) ;
      
                      WScript.Quit( 0 ) ;
      }
      catch
      {
                      WScript.StdOut.WriteLine( "<<edit failed>>" ) ;
                      WScript.StdOut.WriteLine( "<<" + e + ">>" ) ;
      
                      WScript.Quit( 1 ) ;
      }
      
       

      Last edit: Graeme Walker 2021-11-04
  • Graeme Walker

    Graeme Walker - 2021-11-04

    Sorry, my mistake: the "catch" near the end should be "catch(e)".

     
    • Per Arne Christensen

      AWESOME, it works now...
      Thank You very very much for the help and a great email relay program.

      Kind regards

      Per Christensen

      Fra: Graeme Walker graeme_walker@users.sourceforge.net
      Sendt: 4. november 2021 02:23
      Til: [emailrelay:support-requests] 59@support-requests.emailrelay.p.re.sourceforge.net
      Emne: [emailrelay:support-requests] #59 changing from

      Sorry, my mistake: the "catch" near the end should be "catch(e)".


      [support-requests:#59]https://sourceforge.net/p/emailrelay/support-requests/59/ changing from

      Status: open
      Group: v1.0 (example)
      Created: Fri Oct 29, 2021 10:19 AM UTC by Per Arne Christensen
      Last Updated: Fri Oct 29, 2021 01:15 PM UTC
      Owner: nobody

      Hey,

      I tried to use the set from filter but its not working, if i dont use it, it will come up with sendasdenied in log file.
      When i use filter this is the input in log file, can you see what is wrong?

      I have replaced some info in the text under

      emailrelay: 20211029.120344.849: info: smtp connection from 127.0.0.1:51659
      emailrelay: 20211029.120344.849: info: tx>>: "220 Integr01-test.ourdomain.com -- E-MailRelay V2.2 -- Service ready"
      emailrelay: 20211029.120344.852: info: rx<<: "EHLO Integr01-test.ourdomain.com"
      emailrelay: 20211029.120344.852: info: tx>>: "250-Integr01-test.ourdomain.com says hello\r\n250-VRFY\r\n250 8BITMIME"
      emailrelay: 20211029.120344.854: info: rx<<: "MAIL FROM:name.surname@someotherdomain.comname.surname@someotherdomain.com"
      emailrelay: 20211029.120344.855: info: content file: C:\ProgramData\E-MailRelay\spool\emailrelay.2348.1635500340.8.content
      emailrelay: 20211029.120344.855: info: tx>>: "250 OK"
      emailrelay: 20211029.120344.856: info: rx<<: "RCPT TO:post@ourdomain.compost@ourdomain.com"
      emailrelay: 20211029.120344.856: info: tx>>: "250 OK"
      emailrelay: 20211029.120344.856: info: rx<<: "DATA"
      emailrelay: 20211029.120344.857: info: tx>>: "354 start mail input -- end with <crlf>.<crlf>"
      emailrelay: 20211029.120344.858: info: rx<<: [message content not logged]
      emailrelay: 20211029.120344.858: info: rx<<: "."
      emailrelay: 20211029.120344.859: info: envelope file: C:\ProgramData\E-MailRelay\spool\emailrelay.2348.1635500340.8.envelope.new
      emailrelay: 20211029.120344.860: info: filter start: [C:\ProgramData\E-MailRelay\emailrelay-filter.js] [C:\ProgramData\E-MailRelay\spool\emailrelay.2348.1635500340.8.content]
      emailrelay: 20211029.120344.861: info: filter: running [C:\Windows\system32\cscript.exe] [//nologo] [//B] [C:\ProgramData\E-MailRelay\emailrelay-filter.js] [C:\ProgramData\E-MailRelay\spool\emailrelay.2348.1635500340.8.content] [C:\ProgramData\E-MailRelay\spool\emailrelay.2348.1635500340.8.envelope.new]
      emailrelay: 20211029.120345.133: warning: filter failed: exit code 1: [rejected]
      emailrelay: 20211029.120345.134: info: filter done: ok=0 response=[rejected]
      emailrelay: 20211029.120345.134: info: rejected by filter: [rejected]
      emailrelay: 20211029.120345.135: info: tx>>: "452 rejected"
      emailrelay: 20211029.120345.135: info: rx<<: "RSET"
      emailrelay: 20211029.120345.136: info: tx>>: "250 state reset"
      emailrelay: 20211029.120345.136: info: rx<<: "QUIT"
      emailrelay: 20211029.120345.136: info: tx>>: "221 OK"
      emailrelay: 20211029.120345.137: info: smtp connection closed: smtp protocol done: 127.0.0.1:51659
      emailrelay: 20211029.120345.137: info: forwarding: [client disconnect]
      emailrelay: 20211029.120345.138: info: forwarding: no messages to send</crlf></crlf>


      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/emailrelay/support-requests/59/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       

      Related

      Support Requests: #59

  • Graeme Walker

    Graeme Walker - 2022-03-12
    • status: open --> closed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.