mail::loginUrlEncode — Create a mail account URL



#include <libmail/mail.H>

std::string url=mail::loginUrlEncode( std::string method,
  std::string server,
  std::string uid,
  std::string password);


This utility function creates a URL, suitable for mail::account::open(3x), for opening a mail account on a remote server.

method is one of the supported libmail network protocols: "imap", "imaps", "pop3", "pop3s", "nntp", "nntps", "smtp", or "smtps". server is the remote server name. The server name is optionally appended by a colon and a port number, to specify a non-default port for the protocol.

uid identifies the mail account's login id. With "smtp", or "smtps", uid specifies the userid for authenticated ESMTP. The password is optional. mail::account::open(3x) accepts a separate password parameter. This password should be an empty string, so that the resulting URL does not include the password. The real password is then passed as a parameter to mail::account::open(3x). As an alternative, this password parameter can be initialized. The resulting URL will include the password, and the the password parameter to mail::account::open(3x). should be set to an empty string.


Additional protocol options are specified by prefixing each option with the forward-slash character, "/", and appending all options to server (after any optional protocol port number).

Return Codes

This function returns the resulting URL.