Jump to content

Send mail using Found Set and capturing status, MessageID


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

Recommended Posts


Can anyone send me some examples of Send Mail(SMTP Server) function using Found Set records to populate To, CC, BCC?

Also is there any ways to capture status(Sent, failed,, MessageID) of Send Mail function?


Thanks in advance.


Edited by haseebiqbal
Link to comment
Share on other sites

You can use a loop to parse through your found set:

Go to record [first]
  send mail
  set variable [$result; Get ( LastError )]
  if [$result<>0]
     perform script ProcessError[$Result]
  go to record [next/exit after last]
  end loop

You can get the result of the send mail script step using Get ( Lasterror ) and then action it accordingly. If no errors are returned, the email was send successfully. Any other error you can match up in the help. Filemaker is not very elaborate though.

Link to comment
Share on other sites

Thanks Olger but canot related your Send Mail function with the attached one. Seems there are version differences.



Our email server status shows following while send mail from FM Pro

02/09/2015 12:08:22   SMTP Server: PCName????.company.com.au ( connected
02/09/2015 12:08:22   SMTP Server: Message 000BC0D4 (MessageID: <[email protected]>) received
02/09/2015 12:08:22   SMTP Server: PCName????.company.com.au ( disconnected. 1 message[s] received

How I can get the above MessageID from FM Pro and record it in table? Dacons Mail.It plugin could retrieve it using its own native function but I cannot use mail.it plugins here for a policy.

Edited by haseebiqbal
Link to comment
Share on other sites

Filemaker can't retrieve messageids natively. All FM will tell you (via Get ( LastError ) ) is whether a message was handed off to the configured SMTP server successfully. Even if the message fails after that (ie SMTP server can't deliver the message for some reason).

What Filemaker will tell you is whether the communication between the SMTP server and itself encountered errors or not. Beyond that is not possible. To do that, Filemaker would have to keep the connection open or periodically query the SMTP server. Considering emails can be delayed for days, this would place a significant strain on both servers.

So even if Filemaker reports no error, an email can still fail to be delivered. The SMTP server should return the message to the sender (your from addr) if it is unable to deliver.

Link to comment
Share on other sites

If you use a script similar to what I've created, then only one field, either to, cc or bcc will be populated depending on what email_to_cc_bcc has.

So if email_to_cc_bcc has "To", then only the to: field will be populated. However, if your email_to_cc_bcc field has "to" in it (notice the case), it does not get populated. In your scenario, you cannot populate all three fields. As long as the email_to_cc_bcc field is in the same table as the records you are looping through, or are accessible through a relation, it should work.

I gather that is not quite what you want, so you'll have to elaborate what it is you are trying to accomplish.

Link to comment
Share on other sites

This topic is 3102 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.