# Doubt with the plugins.mail.receiveMail

**URL:** <https://forum.servoy.com/t/doubt-with-the-plugins-mail-receivemail/16838>\
**Category:** Classic Servoy\
**Created:** [December 12, 2012, 9:43am UTC](https://forum.servoy.com/t/doubt-with-the-plugins-mail-receivemail/16838 "2012-12-12T09:43:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pentamsi](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@pentamsi](https://forum.servoy.com/u/pentamsi)\
**Post date:** [December 12, 2012, 9:43am UTC](https://forum.servoy.com/t/doubt-with-the-plugins-mail-receivemail/16838/1 "2012-12-12T09:43:31Z")

</div>

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

```auto
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

```auto
	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:

```auto
	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?

---

<div class="post-metadata">

**Author:** ![mboegem](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/mboegem/32/4399_2.png) [@mboegem](https://forum.servoy.com/u/mboegem)\
**Post date:** [December 12, 2012, 10:18am UTC](https://forum.servoy.com/t/doubt-with-the-plugins-mail-receivemail/16838/2 "2012-12-12T10:18:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pentamsi](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@pentamsi](https://forum.servoy.com/u/pentamsi)\
**Post date:** [December 12, 2012, 10:22am UTC](https://forum.servoy.com/t/doubt-with-the-plugins-mail-receivemail/16838/3 "2012-12-12T10:22:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mboegem](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/mboegem/32/4399_2.png) [@mboegem](https://forum.servoy.com/u/mboegem)\
**Post date:** [December 12, 2012, 10:24am UTC](https://forum.servoy.com/t/doubt-with-the-plugins-mail-receivemail/16838/4 "2012-12-12T10:24:58Z")

</div>

Anyway…

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

```auto
//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](http://www.servoy-plugins.de)

---

<div class="post-metadata">

**Author:** ![pentamsi](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@pentamsi](https://forum.servoy.com/u/pentamsi)\
**Post date:** [December 12, 2012, 10:29am UTC](https://forum.servoy.com/t/doubt-with-the-plugins-mail-receivemail/16838/5 "2012-12-12T10:29:29Z")

</div>

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.
