🔐 Why You Need an App Password
Gmail has tightened its security by requiring App Passwords for third-party apps like FoxyPreviewer3. Your regular Gmail password won’t work—even if you enter it correctly. App Passwords are 16-character codes that allow secure access without compromising your main credentials.
You can generate one by visiting Google App Password Settings. Make sure 2-Step Verification is enabled on your account first.
🌐 Choosing the Right SMTP Port
Gmail supports two SMTP ports for sending emails:
Port | Encryption | Use Case |
465 | SSL | Traditional secure SMTP |
587 | TLS / SSL | Modern secure SMTP |
Both work with FoxyPreviewer3—you just need to configure the settings correctly.
🧪 Sample Configurations for FoxyPreviewer3
✅ Using TLS on Port 587
* Send E-mail using smtp.gmail.com using TLS
* Requirements:
* .nEmailMode = 7 && Powerscript Mail
* .cSMTPServer = "smtp.gmail.com"
* .lSMTPUseSSL = .T.
* .lSmtpUseTLS = .T.
* .nSmtpPort = 587
✅ Using SSL on Port 465
* Send E-mail using smtp.gmail.com using SSL
* Requirements:
* .nEmailMode = 2 && CDOSYS Mail
* .cSMTPServer = "smtp.gmail.com"
* .lSMTPUseSSL = .T.
* .lSmtpUseTLS = .F.
* .nSmtpPort = 465
🧩 Full FoxyPreviewer3 Email Script
Here’s a complete example that sends a report as a PDF via Gmail:
DO FoxyPreviewer && https://www.foxypreviewer.com/
WITH _Screen.oFoxyPreviewer
* All e-mail settings that will work for sending under preview or programmatically
* 1 - Your CDOSYS SMTP settings here:
.nEmailMode = 2 && CDOSYS Mail
.cSMTPServer = "smtp.gmail.com"
.lSMTPUseTLS = .F.
.nSMTPPort = 465
.lSMTPUseSSL = .T.
* 2 - Your POWERSCRIPT-Mail SMTP settings here:
.nEmailMode = 7 && Powerscript Mail
.cSMTPServer = "smtp.gmail.com"
.lSMTPUseTLS = .T.
.nSMTPPort = 567
.lSMTPUseSSL = .T.
.cSMTPUserName = "youraccount@gmail.com"
.cSMTPPassword = "abcd efgh ijkl mnop" && Your App Password provided by Google
.cEmailFrom = .cSmtpUserName
.cEmailTo = "vfpimaging@hotmail.com"
.cEmailSubject = "Test FoxyPreviewer Email using GMAIL SMTP server"
.cEmailBody = "Test Email"
* Create a PDF from a Report
LOCAL lcDestFile
m.lcDestFile = SET("Default") + CURDIR() + SYS(2015) + ".pdf"
REPORT FORM _SAMPLES + "Solution\Reports\Colors.frx" TO FILE (m.lcDestFile)
* Send the just created file programmatically
.SendReportToEmail(m.lcDestFile)
ENDWITH
🔐 Security Reminder
To keep your Gmail account safe while using FoxyPreviewer3:
- Never share your App Password publicly—even in screenshots or sample code.
- Avoid hardcoding passwords in scripts. Instead, consider storing them securely using encrypted configuration files or environment variables.
- Use a unique App Password for each application or device. This limits exposure if one gets compromised.
- Monitor your Google Account activity regularly to spot any suspicious logins or unauthorized access.
- Revoke unused App Passwords from your Google Account Settings to reduce risk.