Classic ASP Requires Chilkat v11.0.0+
Classic ASP
Gmail SMTP: Authenticate with an App Password on Port 465
See more GMail SMTP/IMAP/POP Examples
Test app-password authentication over implicit TLS on port 465. This example authenticates and closes the connection without sending a message; its title now reflects that behavior.
Use an account-specific app password generated after enabling 2-Step Verification, loaded from protected configuration. A normal Google password will not work. App passwords may be unavailable under account or Workspace policy; OAuth2 is preferred. Changing the Google account password revokes app passwords. The obsolete less-secure-apps switch is not a setup option. Google app-password requirements.
See the Gmail SMTP, IMAP, and POP3 guide for current authentication choices and Gmail-specific examples.
Chilkat Classic ASP Downloads
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0
' Assumes Chilkat is unlocked. See Global Unlock Sample.
mailbox = "user@example.com"
set mailman = Server.CreateObject("Chilkat.MailMan")
mailman.SmtpHost = "smtp.gmail.com"
mailman.SmtpPort = 465
mailman.SmtpSsl = 1
mailman.StartTLS = 0
mailman.RequireSslCertVerify = 1
mailman.SmtpUsername = mailbox
mailman.SmtpPassword = "YOUR_16_CHARACTER_APP_PASSWORD"
success = mailman.SmtpConnect()
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( "Could not establish the Gmail SMTP TLS connection.") & "</pre>"
Response.End
End If
success = mailman.SmtpAuthenticate()
success = mailman.CloseSmtpConnection()
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( "SMTP authentication failed. Check the app password and account policy.") & "</pre>"
Response.End
End If
Response.Write "<pre>" & Server.HTMLEncode( "SMTP authentication succeeded; no message was sent.") & "</pre>"
%>
</body>
</html>