# MailPro Attachment + Headless Client

**URL:** <https://forum.servoy.com/t/mailpro-attachment-headless-client/19703>\
**Category:** Classic Servoy\
**Created:** [May 31, 2018, 8:51am UTC](https://forum.servoy.com/t/mailpro-attachment-headless-client/19703 "2018-05-31T08:51:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeffrey.vandenhondel](https://avatars.discourse-cdn.com/v4/letter/j/ed8c4c/32.png) [@jeffrey.vandenhondel](https://forum.servoy.com/u/jeffrey.vandenhondel)\
**Post date:** [May 31, 2018, 8:51am UTC](https://forum.servoy.com/t/mailpro-attachment-headless-client/19703/1 "2018-05-31T08:51:55Z")

</div>

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.

```auto
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 = 'info@*.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;

```

---

<div class="post-metadata">

**Author:** ![jeffrey.vandenhondel](https://avatars.discourse-cdn.com/v4/letter/j/ed8c4c/32.png) [@jeffrey.vandenhondel](https://forum.servoy.com/u/jeffrey.vandenhondel)\
**Post date:** [June 5, 2018, 11:45am UTC](https://forum.servoy.com/t/mailpro-attachment-headless-client/19703/2 "2018-06-05T11:45:42Z")

</div>

Found the problem i frogot to register the plugin.  
plugins.MailPro.register(“”, “”);
