Persits Software, Inc. Knowledge Base Articles

The system cannot find the path specified error

Problem Description

When sending a message with AspEmail, the following error may be generated:

Persits.MailSender.4 (0x800A0007)
The system cannot find the path specified.

Solution

This error means the path to a file attachment or embedded image specified via AddAttachment or AddEmbeddedImage cannot be found.

Make sure the path you are specifying exists on the server where AspEmail runs.

Common mistakes:

  • Client-side file paths are used. Some developers erroneously assume that AspEmail running on a web server can attach a file located on a user's machine. For AspEmail to attach a client file, the file must first be uploaded to the server where AspEmail is running. You may use the AspUpload component to capture files uploaded with a browser.

  • An empty argument is passed as a file path. If a message needs to be sent WITHOUT an attachment, some developers still call the method AddAttachment with an empty argument, as follows:

    ' Incorrect!
    Mail.AddAttachment ""

    AddAddress must not be called at all if you do not need to send an attachment.

  • Mapped drives are used. If a file to be attached is located on a mapped drive, you may not always use the mapped drive's letter in your path, as AspEmail may not run in the context of a user account for which the mapping is made.

    If a remote file needs to be attached, use UNC paths, such as:

    Mail.AddAttachment "\\server\share\path\file.ext"