Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: Mail step: Using variable as destination address causes Invalid Address error

  1. #1
    Join Date
    Aug 2016
    Posts
    142

    Default Mail step: Using variable as destination address causes Invalid Address error

    Posted this on the Vantara community page but thought it would be worth a shot here too

    Just wondering if anyone else has come across this problem

    I have a job that generates a user's email by getting the user who last modified an excel file. I then set this address as a variable called USER_EMAIL. I then have ${USER_EMAIL} in the destination box of the mail step.

    If I run the job directly in PDI, it works fine. I created a bat file in order to schedule the job using Windows task scheduler. If I launch the bat file directly, it also works fine however if Task scheduler opens it, I get an Invalid Address error. It appears that the variable is not being substituted

    This is the error from the log:

    Code:
    2018/03/16 09:44:38 - Success Mail - ERROR (version 8.0.0.0-28, build 8.0.0.0-28 from 2017-11-05 07.27.50 by buildguy) : Problem while sending message: javax.mail.SendFailedException: Invalid Addresses;  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 501 5.1.3 Invalid address
    
    
    2018/03/16 09:44:38 - Success Mail - ERROR (version 8.0.0.0-28, build 8.0.0.0-28 from 2017-11-05 07.27.50 by buildguy) :     ** Invalid Addresses
    
    2018/03/16 09:44:38 - Success Mail - ERROR (version 8.0.0.0-28, build 8.0.0.0-28 from 2017-11-05 07.27.50 by buildguy) :          ${USER_EMAIL}




  2. #2
    Join Date
    Jun 2016
    Posts
    107

    Default

    Did you declare this variable (USER_EMAIL) in kettle.properties file?

  3. #3
    Join Date
    Aug 2016
    Posts
    142

    Default

    So it turns out I'm an idiot!

    I missed something in the log that showed that the variable was not actually being set because it was not receiving a row

    I since narrowed that down to the fact that the file is on a network drive and the path I used was using a mapped drive path. When the transformation was run directly in PDI or by directly launching the batch file, this mapping is visible but when using task scheduler, network drive mappings are not visible. Hence it could not find the file and set the variable

    For other steps in transformations (such as Get Files) the fix for this would be to use the UNC path of the file but the Excel input step does not support UNC paths (at least not consistently).

    The fix therefore was to add this line to the batch file:

    net use X: \\machine\share /persistent:no

    Where "X" is the drive letter you want to assign, "machine" is the server name and "share" is the name of the share

    More details can be found here: batch file - Task Scheduler - Access non-local drives while running task not logged in - Stack Overflow



  4. #4
    Join Date
    Apr 2008
    Posts
    4,696

    Default

    Which is basically what Johan, Jens and I were all trying to tell you in different ways on the new forum.

    Your variable is not set somehow when run under scheduled command...
    Because the auto-mapping of drives doesn't happen when run under scheduled command. Known issue with Windows Scheduler.

  5. #5
    Join Date
    Aug 2016
    Posts
    142

    Default

    I had known about the issue with task scheduler and mapped drives but didn't connect the dots

    I had tried your suggestion to put the variable in the body (with a test transformation) and it worked fine so I was then trying to work out the differences between the two. Previously when scanning the logs I was looking for errors but the transformation that was setting the variable was not throwing a fatal error so the job proceeded to the next step

    It was only when scanning the test log line by line did I spot the line about the variable being set. Then comparing to the production one, did I spot the difference and hence realised it was due to the mapped path

    So yeah, the variable was not being set but it was not immediately obvious as the transformation completed successfully and went to the next part of the job.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.