0 votes

Is there a way to verify that the attachment is valid when using MailBuilder?

Example of code...

builder.AddAttachment(lcAttachment); 
// If File is  attached   
lnGoodAttach += 1;
by (1.3k points)

1 Answer

0 votes

What do you mean by valid attachment?

MailBuilder.AddAttachment will threw an exception, if there is a problem (e.g. file access problem)

by (301k points)
So what you are telling me is to put this in a 'Try-Catch' and handle the exception that way?
I mean the chances that AddAttachment fails are minimal, I mean same as reading a file will fail. If you want to detect that add try..catch block
...