Doubt with the plugins.mail.receiveMail

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

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

	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:

	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?

maybe you shouldn’t post username/password of the mailaccount on a forum…

Thanks, i try to delete any user and pass, but the last one forget it

Anyway…

this is the sample code Servoy gives you on retrieving POP mail:

//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

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.