Use mobileconfig.getSignedEmailConfig(options, callback) to generate a signed Email account configuration (IMAP only).
Options Object Properties:
emailAddress: The address to be configured.organization: (Optional) Name of the signing organization.identifier: (Required) Reverse-DNS style identifier (e.g., com.example.myprofile).displayName: (Optional) Name for the profile.displayDescription: (Optional) Description for the profile.accountName: (Optional) Name for the email account.accountDescription: (Optional) Description for the email account.imap: Incoming IMAP configuration:hostname: Server hostname.port: (Optional) Server port.secure: Boolean indicating if TLS/SSL should be used (does not affect STARTTLS).username: Account username.password: Account password.
smtp: Outgoing SMTP configuration:hostname: Server hostname.port: (Optional) Server port.secure: Boolean indicating if TLS/SSL should be used.username: (Optional) SMTP username. If missing, no authentication is used.password: (Optional) SMTP password. If missing, the IMAP password is used.
keys: Object containing key and cert for signing (see Signing configuration).
Callback: (err, data) => void. err is an Error object; data is the signed DER file as a Buffer. Save data as name.mobileconfig to use it.
const options = {
emailAddress: 'my-email-address@gmail.com',
identifier: 'com.my.company',
imap: {
hostname: 'imap.gmail.com',
secure: true,
username: 'my-email-address@gmail.com',
password: 'mypass'
},
smtp: {
hostname: 'smtp.gmail.com',
port: 587,
secure: false,
username: 'my-email-address@gmail.com',
password: false // use the same password as for IMAP
},
keys: {
key: '-----BEGIN PRIVATE KEY-----...',
cert: '-----BEGIN CERTIFICATE-----...'
}
};
mobileconfig.getSignedEmailConfig(options, function (err, data) {
console.log(err || data);
});