locked
how to send message into multiple gmail in jquery RRS feed

  • Question

  • User-1634604574 posted

    how to send message into multiple gmail in jquery

    i wrote this code but not sending

    $("#send_email").click(function () {

    Email.send({
    Host: "zhyan.ise@yahoo.com",
    Username: "zhyan",
    Password: "*ii",
    To: 'zhyanadil.it@gmail.com',
    From: "zhyanadil.it@gmail.com",
    Subject: "This is the subject",
    Body: "And this is the body"
    }).then(
    message => alert(message)
    );
    })

    Thursday, August 29, 2019 9:51 AM

All replies

  • User475983607 posted

    You have not shared enough code to understand how you application works.   Are you using a 3rd party JavaScript Library?

    Thursday, August 29, 2019 10:35 AM
  • User-1634604574 posted

    i'm used this liberary

    <script src="https://smtpjs.com/v3/smtp.js"></script>

    Thursday, August 29, 2019 11:35 AM
  • User475983607 posted

    i'm used this liberary

    <script src="https://smtpjs.com/v3/smtp.js"></script>

    The host configuration should be your SMTP server not your email address.  Did you read the support documentation? 

    I recommend you work with smtp.js support as this question is out-of-scope for this forum.

    Thursday, August 29, 2019 11:42 AM
  • User-1634604574 posted

    i wrote smtp server

    Email.send({
    Host: "smtp.elastmail.com",
    Username: "zhyanadil.it@gmail.com",
    Password: "***kjh",
    To: 'zhyanadil.it@gmail.com',
    From: "smtp.elasticemail.com",
    Subject: "This is the subject",
    Body: "And this is the body"
    }).then(
    message => alert(message)
    );

    but i have this error

    the specified string is not in the form required for an email address 

    Thursday, August 29, 2019 11:52 AM
  • User475983607 posted

    The From address is not an email address.

    From: "smtp.elasticemail.com",

    Please take a few moments to review your code.

    Thursday, August 29, 2019 1:56 PM
  • User-719153870 posted

    Hi zhyanadil.it@gmail.com,

    zhyanadil.it@gmail.com

    $("#send_email").click(function () {

    Email.send({
    Host: "zhyan.ise@yahoo.com",
    Username: "zhyan",
    Password: "*ii",
    To: 'zhyanadil.it@gmail.com',
    From: "zhyanadil.it@gmail.com",
    Subject: "This is the subject",
    Body: "And this is the body"
    }).then(
    message => alert(message)
    );
    })

    I can see this code is from here.

    First, this method is totally workable, i have tested it with my own mails.

    The problem of yours is that some of your parameters's values were set incorrectly.

    Please modify your code like below:

    $("#send_email").click(function () {
                Email.send({
                    Host: "smtp.gmail.com",
                    Username: "zhyanadil.it@gmail.com", //your gmail address
                    Password: "*ii",//your gamil password
                    To: 'targetmail@gmail.com',
                    From: "zhyanadil.it@gmail.com", //your gmail address
                    Subject: "This is the subject",
                    Body: "And this is the body"
                }).then(
                    message => alert(message)
                );
            })

    The interesting thing is that i tested this code with my local mail(not gmail) and in the Password field(The yellow part in above code) i need to set a authorization code(not my mail's password) generated by my local mail setting . This authorization code thing is for secure issue.

    However, there's seems no this authorization code that can be generated by gmail. To test this demo in gmail environment, i registered a gmail and found no authorization code.

    Then, i set the Password field with my gmail password directly, and it worked!!!

    This is not what i wanted, because anyone can see my gmail password only need to press F12 and there is my gmail password!

    In general, i won't suggest you use this method especially with gmail as your isp. You can practice it but don't use in an actual project.

    Best Regard,

    Yang Shen

    Friday, August 30, 2019 7:03 AM
  • User-1634604574 posted

    is there another way to send email without using email.send?

    Friday, August 30, 2019 9:10 AM
  • User-719153870 posted

    Hi zhyanadil,

    In fact, i don't suggest you do the sending email event in client side.

    Usually, we do this event in theserver side, you can search online( how to send email with smtp in asp.net ) and find a lot of articles or tutorials talking about this subject.

    Like this one and this one.

    Best Regard,

    Yang Shen

    Friday, August 30, 2019 9:27 AM