Discussions

 View Only
  • 1.  Is there any way to send out emails via script page?

    Posted 06-03-2018 15:18
    Does anyone know if there is any way to send out emails via script page?

    How about using: require 'gmail_sender'
    and adding your gmail user and password etc?

    Thanks


  • 2.  RE: Is there any way to send out emails via script page?

    Posted 06-05-2018 10:35
    Try this code:

    Pastie Database
    https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=660

    Notes:

    (1) The function takes arguments email, subject and message and returns a promise which resolves when the email has been sent via the native method UserWin:
    function QBU_SendEmail(email, subject, message) {...}
    (2) You use the function in this fashion:
    var email = "dandiebolt@gmail.com";
    var subject = "Subject";
    var message = "<h1>Hello ${firstName} ${lastName}</h1><p>Did you file your TPS Reports?</p>";
    QBU_SendEmail(email, subject, message)
      .then(function() {
        //your further code here
      });
    (3) The native UserWin method requires the userid (eg "51084879.bdbt") which is obtained by passing the user's email to API_GetUserInfo.

    (4) The message is passed as a very short template which can include references to tokens for the firstName and lastName. The message can also include HTML markup.

    (5) If you intent to do bulk emails you can't just wrap a loop around this code as your browser will process the code as fast as possible and will eventually run out of sockets at which time the browser will lock up. One solution it to wrap the code in an async function.


  • 3.  RE: Is there any way to send out emails via script page?

    Posted 06-05-2018 17:33
    Thanks Dan. To clarify this will send it via quickbase and from address will be notify@quickbase.com and the reply to will be the users email address. I was looking to sent it via gmail user and password. But if that's not possible, this solution will definitely be helpful.

    Thanks again.