FoxPro Programming
VFP9 SMTP for Gmail
Gravatar is a globally recognized avatar based on your email address. VFP9 SMTP for Gmail
  Steve
  All
  May 30, 2016 @ 09:07am

I need to send an email with up to 4 attachments from my gmail account. Can I do this with WW classes (e.g. wwsmtp.prg)?

If so,

  1. Specifically, Which files do I need in my project?
  2. Other files needed in other folders?
  3. Are there any step-by-step instructions to make this happen?

I've tried Blat, Mail Alert, Mail Send, Foxypreviewer. All had problems, some worked with my Verizon account but not with Gmail. I've tried smtp sample substituting parameters (e.g. port 465) to no avail. Google is no help of course.

Thanks for any help.

Steve

Gravatar is a globally recognized avatar based on your email address. re: VFP9 SMTP for Gmail
  Rick Strahl
  Steve
  May 30, 2016 @ 01:56pm

Yes you can send emails using GMails SMTP server. I don't think port 465 is correct. They use port 587 for TLS connections.

This works for me (using the wwSmtp Sample provided):

*** Load required libraries
DO wwSmtp 

LOCAL loSmtp as wwSmtp
loSmtp = CREATEOBJECT("wwSmtp")

*** Select mail mode. 0 - .NET wwSmtp  2 - Classic wwIPstuff (default)
*** Note: Mode 2 only supports SendMail and SendMailAsync
***       and no support for alternate views
loSmtp.nMailMode = 0

loSmtp.cMailServer = "smtp.gmail.com:587"

*** Timeout in seconds
loSmtp.nTimeout = 25

*** Optionally use SSL/TLS if the mail server requires it
loSmtp.lUseSsl = .T.

*** Specify user name and password if auth is required
loSmtp.cUsername = "yourname22@gmail.com"
loSmtp.cPassword = "seekret"

loSmtp.cSenderName= "wwIPstuff Samples"
loSmtp.cSenderEmail = "support@mydomain.com"

*** The following are all comma delimited recipient lists of email addresses
*** you can optionally use "Name" <email@address.com> as the format to
*** have a display name
loSmtp.cRecipient = [jimmyd@mydomain.com,"John" <johndoe@mydomain.com>]


*** Actual message properties
loSmtp.cSubject = "wwSMTP Test Message"
loSmtp.cMessage = "<b>HTML Test message from wwsmtp, to check out how this operation works.</b>"

*** If cMessage contains HTML set cContentType to text/html
loSmtp.cContentType = "text/html"


loSmtp.AddAttachment("c:\sailbig.jpg")


*** Single Mail Sending - connect/disconnect for message
#IF .T.
	llResult = loSmtp.Sendmail()
	IF llResult
	   WAIT WINDOW "Mail sent..." nowait
	ELSE
		? "Mail sending failed: " 
		? loSmtp.cErrorMsg
	ENDIF	
#ENDIF

Just change the username and password and recipient.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: VFP9 SMTP for Gmail
  Steve
  Steve
  May 30, 2016 @ 02:38pm

Thanks, Rick.

"*** Load required libraries"

I guess I need the kindergarden version. What are the required libraries I need to load. Is it SET LIBRARY TO...?

Steve

Gravatar is a globally recognized avatar based on your email address. re: VFP9 SMTP for Gmail
  Rick Strahl
  Steve
  May 30, 2016 @ 10:10pm

DO wwSmtp loads the libraries needed.

Just make sure to distribute wwipstuff.dll, wwsmtp.dll and wwdotnetbridge.dll.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: VFP9 SMTP for Gmail
  Steve
  Rick Strahl
  May 31, 2016 @ 12:50am

Where do I get wwsmtp.dll? It was not in the download.

Gravatar is a globally recognized avatar based on your email address. re: VFP9 SMTP for Gmail
  Rick Strahl
  Steve
  May 31, 2016 @ 07:37am

Sorry, there's no wwsmtp.dll. Just the other two... wwsmtp.prg is the main file that holds the component but it's just a prg file.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: VFP9 SMTP for Gmail
  Steve
  Rick Strahl
  Jun 2, 2016 @ 02:25am

Still doesn't work. I've tried everything I could think of. Could not get WW to connect. Could be my computer (Win10). I don't know. So at this point, I don't think buying WW would work for me. Anyway, thanks for your help.

Steve

Gravatar is a globally recognized avatar based on your email address. re: VFP9 SMTP for Gmail
  Rick Strahl
  Steve
  Jun 2, 2016 @ 07:23am

What error are you getting?

Also you might have to check your firewall to make sure you can get out to the Internet on port 587 from your app.

I see no reason why this shouldn't work for you.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: VFP9 SMTP for Gmail
  Dova
  Rick Strahl
  Mar 11, 2020 @ 11:59pm

File wwsmtp.prg does not exist. How do I get it and where should I place wwipstuff.dll and wwdotnetbridge.dll. Are these two required?

Gravatar is a globally recognized avatar based on your email address. re: VFP9 SMTP for Gmail
  Tore Bleken
  Dova
  Mar 12, 2020 @ 01:36am

Instead of replying to a 4 years old message, please create a new thread.

© 1996-2024