February 26, 201510 yr This use to work regardless if all the EmailAttachFile exited or not. But now it doesn't and I don't now how to code in If thens in the code. This code works if all the EmailAttachFile have files in the containers or file locations. EmailConnectSMTP( "mailfwd.xxx.gov" ) and EmailCreate( "xxxx xxx <[email protected]>" ; Employees self via Sup1 to full name::Email ; "Review for " &Employees::Full Name & " and " & Count(Files selected::File UID)+3 & " files" ) and EmailSetBody( $$emailbody ; "plain" ) and EmailAttachFile( Employees::global container ) and EmailAttachFile( Employees::global container 2) and EmailAttachFile( Employees::global container 3) and EmailAttachFile( Employees::global container 4) and EmailAttachFile( getvalue ( $$filessaved ; 1 )) and EmailAttachFile( getvalue ( $$filessaved ; 2 )) and EmailAttachFile( getvalue ( $$filessaved ; 3 )) and EmailAttachFile( getvalue ( $$filessaved ; 4 )) and EmailAttachFile( getvalue ( $$filessaved ; 5 )) and EmailAttachFile( getvalue ( $$filessaved ; 6 )) and EmailAttachFile( getvalue ( $$filessaved ; 7 )) and EmailSend and EmailDisconnect
February 26, 201510 yr Looking at this script, I would expect that whenever one (or more) of those EmailAttachFile function calls fails, the email won't send. This is due to short-circuit evaluation of all these function strung together with the 'and' operator. If you're not familiar with short-circuit evaluation, it's a method of conditional evaluation without using more common control structures like if/then or loops. Basically, when connecting expressions with 'and' operators, as you are, if any one of them fail, then the subsequent expressions won't be evaluated at all. In your case, if any of the AttachFile functions fail, the EmailSend function will never be called. If you separate those statements into their own Set Variable script step, you can avoid the short-circuit functionality, and this script should work.
February 27, 201510 yr Author OK. Thanks. That is what I was trying but didn't know the syntax the plugin would accept. What is funny is that it use to work.
Create an account or sign in to comment