Can’t Attach PDF File to Email in JavaScript Using smtpjs

  1. Summarize the problem

I am unable to attach a PDF file to an email to be sent to an email address. The PDF file is in the same folder as the HTML file, which contains the JavaScript code to send the email using SMTPJS.

Expected result:
An email is sent to the designated email address with the pdf file without any problems.

Actual result:
No email was sent at all.

  1. Describe what you’ve tried

#1: Attempt by putting file name and extension in quotes like this:

PFD_Articles.pdf -> ‘PFD_Articles.pdf’

Again, the actual result is produced, not the expected one.

  1. Show some code
Email.send
(
    {
        Host: "smtp.gmail.com",
        Username: "[email protected]",
        Password: "password",
        To: '[email protected]',
        From: "[email protected]",
        Subject: "<h1> ddd </h1>",
        Body: "And this is the body",
        Attachments:
            [
                {
                    name: 'PFD_Articles.pdf'
                }
            ]
    }).then
(
    alert("Successful! Please check your email inbox. Otherwise, you may have to enter your email address again.")
);