Limit Attachment Size when Mailing

I have the code below in the input validation of a field. But, it is prompting the user for the message but is still allowing them to send over the max size. Can someone please look at this code and offer some assistance. Thanks in advance.

MinSize :=1000000;

MaxSize := 10000000;

DocLen :=@DocLength;

DocSize := @Text(@Integer(@DocLength / 100000) / 10; “F,1”);

WarnMax := “This message cannot be sent or saved as it has attachments totaling " + DocSize + " Megabytes (MB) in size. Messages with attachments totaling 100 MB or larger will not be delivered due to the adverse affect on the network and recipients’ mail systems. Please compress all attachments before attempting to send the message again.”;

WarnMin :=“This message has attachments totaling " + DocSize + " Megabytes (MB) in size. Messages with attachments totaling 1 MB or larger can severely impact network performance and will not be delivered until after 6:00 PM EST. Click Yes to continue sending the message as is, or click No to cancel sending and make changes such as compressing the attachments.”;

temp1 := @If(@IsDocBeingMailed & (DocLen > MinSize & DocLen < MaxSize); @Prompt([YesNo]; “This message will be delivered during non-business hours!”; WarnMin);“”);

temp2 := @If(@IsDocBeingMailed & (DocLen > MaxSize);@Prompt([Ok];“Oversized Attachment”;“This message exceeds the allowed attachment size and will not be delivered!”; WarnMax);“”);

@If(@DocLength > MaxSize; @Failure(WarnMax);

@IsDocBeingMailed & (DocLen > MinSize & DocLen < MaxSize) & temp1 != 1;

@Failure(“Message not sent!”);@Success);

@IsDocBeingMailed & (DocLen > MaxSize) & temp2 = 1;

@Failure(“Message not sent!”);@Success

Subject: Limit Attachment Size when Mailing

how does the message actually get sent? All I see here is that your field may or may not pass validation but where/how are you triggering the mail to be sent? Also, not saying whether I agree or disagree with your code at this point.

Subject: RE: Limit Attachment Size when Mailing

Hi,

Date

Topic

2002-10-10

RE: Working with the mail template

JYR

Subject: RE: Limit Attachment Size when Mailing

The code is in the validation of a field Delivery Priority in the memo form of the mail template.

Thanks

Subject: Limit Attachment Size when Mailing

Hi,

Typ your code in Lotus Script in the Querysend event of the form or subform. calculate in this event the maxsize what you allow and if the size exceed your limit , set continue to false.

Afterwards nothing will be send…

Bernhard