MailPro Attachment + Headless Client

The forum to discuss the Headless version of Servoy. Web, Java and Servlet development questions can all be posted here.

MailPro Attachment + Headless Client

Postby jeffrey.vandenhondel » Thu May 31, 2018 10:51 am

Hello,

I am trying to send a email with the MailPro Plugin with a attachment. Trough a headlessclient but the attachment doesn't get add to the email.
But i receive a message but without a attachment.
If i run the same code in my webclient it does work.
There are no errors in the log.
When i set some application outputs the file is there so the headlessclient sees the file.

Code: Select all

var fsSettingsEmail = datasources.db.*.settings.getFoundSet();
      fsSettingsEmail.loadAllRecords();

      var vSmtp = plugins.MailPro.SMTPAccount();

      vSmtp.host = fsSettingsEmail.smtp_host;
      vSmtp.port = fsSettingsEmail.smtp_port;
      vSmtp.userName = fsSettingsEmail.smtp_login_name;
      vSmtp.password = fsSettingsEmail.smtp_password;
      vSmtp.requiresAuthentication = fsSettingsEmail.is_authenticate_smtp;
      vSmtp.useTLS = true;

      if (!replyToAdress) {
         replyToAdress = '[email protected]*.nl';
      }

      var message = vSmtp.createMessage(this.sendTo, replyToAdress, this.mailSubject, this.mailText);
      message.htmlMsg = this.mailText;
      message.replyTo = replyToAdress;

      if (this.readReceipt) {
         message['addHeader']("X-Confirm-Reading-To", replyToAdress);
         message['addHeader']("Disposition-Notification-To", replyToAdress);
         message['addHeader']("Return-Receipt-To", replyToAdress);
      }

      if (this.sendCc) {
         message.ccAddresses = this.sendCc;
      }
      if (this.sendBcc) {
         message.bccAddresses = this.sendBcc;
      }

      if (this.fileLocations) {
         for (var x = 0; x < this.fileLocations.length; x++) {
            var filePath = this.fileLocations[x];
            if (file.canRead()) {
               message.addAttachment(plugins.MailPro.Attachment(filePath));
            }
         }
      }
      vSmtp.sendMessageInBackground(message);
      return true;

jeffrey.vandenhondel
 
Posts: 32
Joined: Thu Jul 28, 2016 9:05 am

Re: MailPro Attachment + Headless Client

Postby jeffrey.vandenhondel » Tue Jun 05, 2018 1:45 pm

Found the problem i frogot to register the plugin.
plugins.MailPro.register("", "");
jeffrey.vandenhondel
 
Posts: 32
Joined: Thu Jul 28, 2016 9:05 am


Return to Servoy Headless Client

Who is online

Users browsing this forum: No registered users and 0 guests

cron