Jump to content

Email error with Multiple attachments/missing attachments


Bailey Kessing
 Share

This topic is 2836 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This topic is 2836 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.