Doubt with the plugins.mail.receiveMail

Questions and answers on developing, deploying and using plugins and JavaBeans

Doubt with the plugins.mail.receiveMail

Postby pentamsi » Wed Dec 12, 2012 11:43 am

I'm trying to get the new mail arrived to an account, but i'm doing something wrong. I try with pop3 and smtp, but not recive anything. Anyone can say me what is wrong?

This os for the pop3
Code: Select all
var properties = [];
   properties[0] = 'mail.pop3.port=110';
   properties[1] = 'mail.pop3.ssl.enable=false';
   properties[2] = 'mail.pop3.host=192.168.69.4';
   properties[3] = 'mail.pop3.user=username';


This is for stmp
Code: Select all
   properties.push('mail.smtp.host=192.168.69.4');
   properties.push('mail.smtp.port=993');
   properties.push('mail.smtp.auth=true');
   properties.push('mail.smtp.username=username');
   properties.push('mail.smtp.password=pass');
   properties.push('mail.smtp.ssl.enable=true');


And the function:
Code: Select all
   var msgs = plugins.mail.receiveMail('user', 'pass!', true, 1, null, properties);


And return a null. Thanks for all. And it's posible to use IMAP?
Last edited by pentamsi on Wed Dec 12, 2012 12:22 pm, edited 1 time in total.
Image
User avatar
pentamsi
 
Posts: 335
Joined: Thu Nov 03, 2011 2:20 pm
Location: Barcelona, Spain

Re: Doubt with the plugins.mail.receiveMail

Postby mboegem » Wed Dec 12, 2012 12:18 pm

maybe you shouldn't post username/password of the mailaccount on a forum...
Marc Boegem
Solutiative / JBS Group, Partner
Servoy Specialist
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image
User avatar
mboegem
 
Posts: 1758
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Doubt with the plugins.mail.receiveMail

Postby pentamsi » Wed Dec 12, 2012 12:22 pm

Thanks, i try to delete any user and pass, but the last one forget it
Image
User avatar
pentamsi
 
Posts: 335
Joined: Thu Nov 03, 2011 2:20 pm
Location: Barcelona, Spain

Re: Doubt with the plugins.mail.receiveMail

Postby mboegem » Wed Dec 12, 2012 12:24 pm

Anyway...

this is the sample code Servoy gives you on retrieving POP mail:
Code: Select all
//Receive mails from pop3 account.
   var msgs = plugins.mail.receiveMail('me', 'test', true);
   if (msgs != null) //if is null error occurred!
   {
      for (var i = 0; i < msgs.length; i++) {
         var msg = msgs[i]
         application.output(msg.getFromAddresses())
         application.output(msg.getRecipientAddresses())
         application.output(msg.getReplyAddresses())
         application.output(msg.getReceivedDate())
         application.output(msg.getSentDate())
         application.output(msg.getHeaders())
         application.output(msg.getSubject())
         application.output(msg.getHtmlMsg())
         application.output(msg.getPlainMsg())
         var attachments = msg.getAttachments()
         if (attachments != null) {
            for (var j = 0; j < attachments.length; j++) {
               var attachment = attachments[j]
               application.output(attachment.getName())
               var attachmentDataByteArray = attachment.getData()
               //write attachmentDataByteArray to a file...
            }
         }
      }
   }


If I'm not mistaken POP3 is turned off by default for gmail accounts, so you'll need to change that on the account itself.

If you want to use IMAP take a look at the mailpro plugin at http://www.servoy-plugins.de
Marc Boegem
Solutiative / JBS Group, Partner
Servoy Specialist
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image
User avatar
mboegem
 
Posts: 1758
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: Doubt with the plugins.mail.receiveMail

Postby pentamsi » Wed Dec 12, 2012 12:29 pm

The finnal account not is necessary to be gmail, in this case i want to use a company account mail. I'm trying to use the mail pro plugin, thanks.
Image
User avatar
pentamsi
 
Posts: 335
Joined: Thu Nov 03, 2011 2:20 pm
Location: Barcelona, Spain


Return to Plugins and Beans

Who is online

Users browsing this forum: No registered users and 5 guests

cron