Jump to content
Sign in to follow this  

Script to keep only a single email address in a field

Recommended Posts


Am trying to clean up the email field on a filemaker database.  At the moment there are many records that contain more than one email address or an email address and text.

what I want to do is delete everything in the field apart from the first email address

In the vast majority of cases the required email address is the first thing in the field.  So my thinking is that the script would have to read along until it found an "@" symbol and then truncate the text at the next space comma or backward or forward slash as they are generally the methods people have used to separate the email addresses.

Apart from that am struggling - I would be delighted if someone could give me some pointers on this

Share this post

Link to post
Share on other sites
25 minutes ago, john777 said:

space comma or backward or forward slash as they are generally the methods people have used to separate the email addresses.

Can you provide an exact list of all possible separators - or more precisely, separator strings? A forward slash is a valid e-mail address character, so I presume you mean it was used surrounded by spaces? So this particular separator string would be:
" / "

Edited by comment

Share this post

Link to post
Share on other sites

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
Sign in to follow this  

  • Similar Content

    • By Rabernethy
      I have inherited a database in Filemaker 12 on Windows, but I am completely new to databases. I have a script which generates and saves a pdf for each person using fields from their record. This works well.
      I then have a second script which is meant to email each of these pdfs to the corresponding person. I have included screen shots of the script and the "send mail" options.
      When I tested it by putting only my own email address in the To: box, it sent me hundreds of emails each with a different name in the text, and the correct corresponding pdf attached, as expected.
      Very embarrassingly, when I tried to send the pdfs out, it sent an email to each person with the right name in the body of the text, but all with the same email attachment (for the first person in the list)! What did I do wrong?
      Thank you in advance for any advice you can offer.

    • By elipsett
      I've been using FMP13 on MacOSX 10.12.6 with Apple Mail to send FMP-generated emails with attached PDFs. 
      I recently switched from Apple Mail to Airmail, and it is now impossible to send emails from FMP.

      Does anyone know if Airmail can send mail with attachments on Sierra MacOS 10.12.6, if I upgrade to FMP16?
      That's the only reason I might really need to upgrade, and since upgrading to FMP16 will also require a few new computers to run the new OS that the new FMP demands, I'd rather not spend all that money now if I can avoid it.
    • By Z162
      I'm using 360 works eMail Plugin with FM Pro Advanced 16 and FMS 16 with success. I try to use last version 3.05 with Filemaker Cloud, but I have an issue with the "GetNextMessage". This command doesn't work. I can see Mailboxes, number of messages and so on, but reading message is impossible.
      Someboby has a solution ?
      Thank's !
    • By KassK
      I have been asked to set up something that will send out email automaticly when the date in the "review date" field is 14 days prior to the current date, can someone help me with a script that would be able to perfom this task? I have also created and email field that will hold the email address.
      thank you
    • By drrehak
      I am using EmailRecipients () , and we have noticed that sometimes duplicate emails are being sent. I had one customer who said they received 10!
      any ideas? My script is:
      Set Variable [ $result ; Value:EmailConnectSMTP("smtp.gmail.com:465";"info@**********.com";"*********";"ssl=1") ]
      If [ $result ≠ 1 ]
      Show Custom Dialog [ Message: EmailLastError & ¶ & "Feedback emails failed! Password most likely wrong. Tell Doc."; Default Button: “OK”, Commit: “Yes” ]
      Go to Layout [ original layout ]
      Exit Script [  ]
      End If
      #send email to foundset
      Go to Record/Request/Page [ First ]
      Loop Set Variable [ $first ; Value:patients::first ]
      Set Variable [ $email; Value:patients::email ]
      Set Variable [ $subject; Value:$first & ", Happy Birthday from Colonial Family Eyecare!" ]
      Set Variable [ $msgCreate ; Value:EmailCreate(  "info@************.com";patients::email  ;$subject ) and EmailSetBody( $$body)
      Set Variable [ $setRecipients ; Value:EmailRecipients($email) ]
      Set Variable [ $sent; Value:EmailSend ]
      If [ $sent ≠ 1 ]
      Show Custom Dialog [ Message: EmailLastError; Default Button: “OK”, Commit: “Yes” ; Button 2: “Cancel” , Commit: “No” ]
      End If
      Go to Record/Request/Page [ Next; Exit after last ]
      End Loop Set Variable [ $disconnect ; Value:EmailDisconnect ]
      If [ $disconnect="ERROR" ]
      Show Custom Dialog [ Message: EmailLastError; Default Button: “OK”, Commit: “Yes” ]
      Exit Script [  ]
      End If
  • Who Viewed the Topic

    2 members have viewed this topic:
    DR. ALI BAHAR  SarahS 

Important Information

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