MailSend - Don't proccess if blank

I have a form that is used to add documents to a database. One of the fields (EmailBuy) is a ComboBox populated with a small list of usernames from another database (that uses the Directory) and is used to email a link of the new document to the specified user. This is the emailing code attached to the ADD DOCUMENT button

MailTo := (EmailBuy);

@MailSend(MailTo;“”;“”;“New Part Admin Document Added”;"A new document has been added to the database, follow the document link to view - ";“PartCode”;[IncludeDoclink]);

This works fine but on rare occasions I don’t want to select a user from the combobox and then I get a message from the MailSend function saying that there is no SendTo value.

How can I wrap my code up so that if I have not selected a user in the combobox it will ignore the mailsend and carry on with any following code.

thanks

Martin

Subject: try this…

@If(@IsNull(EmailBuy);@Nothing;@MailSend(EmailBuy;“”;“”;“New Part Admin Document Added”;"A new document has been added to the database, follow the document link to view - ";“PartCode”;[IncludeDoclink]));

Subject: That’s great

Works a treat - many thanks