Application.MailLogon method (Project)
Logs on to a MAPI mail system and establishes a mail session. A mail session must be established before mail or document routing methods can be used.
expression A variable that represents an Application object.
|Name||Optional||String||The mail account name.|
|Password||Optional||String||The mail account password.|
|DownloadNewMail||Optional||Boolean||True if new mail is downloaded immediately.|
Previously established mail sessions are logged off before an attempt is made to establish the new session. Omit both Name and Password to use the default mail session for the system.
The following example logs on to the mail system and downloads any new mail.
Sub SessionLogon() If IsNull(MailSession) Then Application.MailLogon "oscarx", "mypassword", True End If End Sub
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.