• Thanks

    I found some code that I modified and it is working well

    DECLARE @isExists INT

    exec master.dbo.xp_fileexist 'E:\ZipBatches\ReactorBatches.zip',

    @isExists OUTPUT

    SELECT case @isExists

    when 1 then 'yes'

    else 'No'

    end as isExists

    IF @isExists = 1

    BEGIN

    USE msdb

    EXEC sp_send_dbmail

    @profile_name='CFServerMail',

    @recipients='georgeg@communityfuels.com',

    @subject='Batch Reports for Yesterday',

    @body='This is an auto generated mail message, Please DO NOT Reply

    Batch Reports are included in this email as a Zip File.',

    @file_attachments='E:\ZipBatches\ReactorBatches.zip'

    END

    IF @isExists = 0

    BEGIN

    USE msdb

    EXEC sp_send_dbmail

    @profile_name='CFServerMail',

    @recipients='georgeg@communityfuels.com',

    @subject='NO Batch Reports yesterday',

    @body='This is an auto generated mail message, Please DO NOT Reply

    NO Batch Reports are available for yesterday.'

    END