Search code examples
javascriptjqueryemailgmailhtml-email

Can I send mail using Javascript and jquery without a server?


I can use only javascirpt and jquery.

My customer said without server and using javascript and jquery can send email from gmail SMTP.

Gmail SMTP surpport only use javascript and jquery can send Email? and without server?

I want send email the mail template(html) in dynamic value (without Server!)

I tried this URL content.

https://github.com/dwyl/learn-to-send-email-via-google-script-html-no-server#how

But I have to send an e-mail with the entered ID. This ID is dynamic value.


Solution

  • You can not send an email direct from front-end using JavaScript, Jquery or any front-end framework/library externally using server or back-end. because your credentials are open to all and there are so many factors work behind that...

    An option is to let each user use his or her sociable mail server, by doing a mailto: connection, which allows you to define the header data & including a quasi-header called 'body', which sets the content you require to pass in the message body.

    You can Send Using:-

    There are also some parameters to add:

    However, you can append parameters to email like the following:-

    Here are some parameters you can pass in the mail you want to send from front-end

    mailto:-add recipients,

    note:- if you want to add multiple recipients then add comma-separated as mentioned in the example.

    &cc= to add CC recipients,

    &bcc= to add BCC recipients,

    &subject= to add mail subject,

    &body= to add mail body,

    Example:-

    <a href="mailto:[email protected][email protected][email protected]?subject=Mail-SubJect
      &body=Mail-Body....">
    Send Me Email from Front-end
    </a>
    

    Some customer-service providers provide you to send an email with the help of their service smtpjs, formspree, emailjs, Google APIs, but this is not practical plus trusted.