Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Email error with Multiple attachments/missing attachments


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

Recommended Posts

Posted

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
Posted

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.

This topic is 3555 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
×
×
  • Create New...

Important Information

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