Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trying to use vfpwinsock to send email
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01597328
Message ID:
01597389
Views:
48
>I'm trying to create an app to send emails of our bill to our customers. And am totally lost.
>I did find vfpwinsock which looks easy to use. In trying the example I keep getting a
>"Must issue a STARTTLS command first". I know this is supposed to upgrade the
>connection to a secure connection, but have to clue how to issue the command.
>
>I don't see a reference to the on the example screen form and I frankly don't understand
>the logic in vfrpwinsock.prg
>
>If anyone has used this and can give me some insight, I would appreciate it. Or can even
>tell me a tried and true app to send emails from visual FoxPro I would appreciate that also.
>
>Brad

Hi,
I am using the winsock wrapper as published on the aToutFox (France) VFP forum:

#Define crlf Chr(13)+Chr(10)

oWinsock = Createobject("MSWinsock.Winsock.1")
oWinsock.Protocol = 0 && 0=TCP Protocol, 1=UDP
oWinsock.RemoteHost = '65.39.231.158'&&"mail.suntelecom.net"
oWinsock.RemotePort = 25 && smtp port.
oWinsock.Connect
=Inkey(.25)
oWinsock.senddata("Hello myself.com" + crlf) && You can change this string to anything else..
line1 = "mail from:" + Chr(32) + "moi@somewhere.net" + crlf
line2 = "rcpt to:" + Chr(32) + "you@hotmail.com"+ crlf
line3 = "Date:" + Chr(32) + Dtoc(Date()) + crlf
line4 = "From:" + Chr(32) + "mei@somewhere.net" + crlf
line5 = "To:" + Chr(32) + "you@hotmail.com" + crlf
line6 = "Subject:" + Chr(32) + "Test winsock mail" + crlf
line7 = "This is a test body of the message" + crlf
line9 = "X-Mailer: Mike's Test mail" + crlf
line8 = line4 + line3 + line9 + line5 + line6 + line7
oWinsock.senddata(line1)
=Inkey(.25)
oWinsock.senddata(line2)
=Inkey(.25)
oWinsock.senddata(line8 + "." + crlf)
=Inkey(.25)
oWinsock.senddata("quit")
=Inkey(.25)
oWinsock.Close()


Regards,

KoenP
Previous
Reply
Map
View

Click here to load this message in the networking platform