Well here is some code that does not work. Actually, it works, but it is sending using the settings in SystemsSettings. The email account for the "Organization" is a Gmail account and in system settings, it is a commercial smtp for which I can see the logs. It's definitely going through the commercial smtp in SystemSettings. My Outgoing Email Account is called OrganizationEmailAccount which is owned by Organization. One OrganizationEmailAccount record exists.
If EXISTS OrganizationEmailAccount WHERE (OrganizationEmailAccount.Organization=LoggedInInvestigator.Organization) Then
DISPLAY MESSAGE 'SMTP Found.'
FIND OrganizationEmailAccount WHERE OrganizationEmailAccount.Organization=LoggedInInvestigator.Organization
SEND WelcomeCandidate TO Candidate USING OrganizationEmailAccount
The second issue is that if I change it to:
If NOT(EXISTS OrganizationEmailAccount WHERE (OrganizationEmailAccount.Organization=LoggedInInvestigator.Organization) Then ...
I get the exact same result and the DISPLAY MESSAGE is never presented.
So the problem is two-fold: my IF EXISTS statement seems inert and my SEND USING command seems to be ignoring the USING attribute of the command. I suspect that the SEND USING is ignoring the USING because no such account is in context, Goes back to why is the EXISTS statement being totally disregarded here and the FIND must not be returning anything maybe?
Somebody throw me a line here.