Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to send e-mail from Visual FoxPro
Message
From
22/12/2018 01:04:08
 
 
To
21/12/2018 14:32:26
General information
Forum:
Visual FoxPro
Category:
Internet applications
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01663591
Message ID:
01664825
Views:
50
>>>>>>>>>I'm developing a VFP9 app and it needs to send email (simple or with a file attached) with a free tool or free library. I remember several years ago (2009) when there were some tools that worked (although I don't remember their names). I'd like to use my gmail account for testing (but not using gmail client).
>>>>>>>>>
>>>>>>>>>One (less desired) alternative would be to use Outlook in the background (without showing it on screen).
>>>>>>>>>
>>>>>>>>>TIA
>>>>>>>>
>>>>>>>>Tore,
>>>>>>>>
>>>>>>>>There are lots of answers in this thread from lots of people but there is only one question from Luis:
>>>>>>>>
>>>>>>>>One (less desired) alternative would be to use Outlook in the background (without showing it on screen).
>>>>>>>
>>>>>>>That is the problem. In the company, there are several Office versions from 2007 until 2016 or even Office 365. Unfortunately, they do not have control on Office versions.
>>>>>>>
>>>>>>>>
>>>>>>>>Unfortunately Luis does not stipulate which MSOffice.Outlook version he would like to use.
>>>>>>>>So using Chilcat as proposed by Mike is a workable solution since that will work with any MSOffice version including 365.
>>>>>>>>
>>>>>>>>
>>>>>>>>Regards,
>>>>>>>>
>>>>>>>>Koen
>>>>>>
>>>>>>Luis,
>>>>>>
>>>>>>It is a pity you cannot / do not want to use Gmail, as otherwise VFPWinsock by Francis, pure in VFP code, and free of charge, up to your to spend a free contribution, works like a charm.
>>>>>>VFPWinsock is to be found at the France VFP Usergroup: http://www.atoutfox.org/nntp.asp and on http://www.vfpwinsock.com/telecharger.asp?LANGUE=GB . However please note, due to restrictions of Google it wont work with Gmail mail provider.
>>>>>>
>>>>>>Koen
>>>>>
>>>>>Hi Koen,
>>>>>
>>>>>I've tried VFP WinSock with Office 365 email accounts, and it always shows me error when sending, I spite of the fact that I folllowed step by step their instructions, I cannot pass beyond this error:
>>>>>
" <= SGetData : ERROR [504 5.7.4 Unrecognized authentication type [SC1P152CA0133.LAMP152.PROD.OUTLOOK.COM]] -> ERR09 : Le retour attendu était :334"
>>>>>
>>>>>Any help would be appreciated.
>>>>
>>>>Luis,
>>>>
>>>>I am sorry, maybe I was not so clear but, . However please note, due to restrictions of Google it wont work with Gmail mail provider.
>>>>Solution: use an other email provider as provider for Winsock
>>>>
>>>>Regards,
>>>>Koen
>>>
>>>Yes, I am using Microsoft Office 365's email provider.
>>Luis,
>>If you still encounter the error please upload here the code you are using to call VFPWInsock
>>Regards,
>>Koen
>
>This is my code:
>
>* Source Code
>SET PROCEDURE TO vfpWinsock
>LOCAL loSendMail
>loSendMail=CREATEOBJECT("VFP_Winsock_Send_Mail")
>loSendMail.SMTP_Host = "smtp.office365.com"
>loSendMail.SMTP_PORT= 587
>loSendMail.FROM = "lguerra@skynetperu.pe"
>loSendMail.FROM_NAME = "Luis Guerra"
>loSendMail.AUTH_LOGIN = "lguerra@skynetperu.pe"
>loSendMail.AUTH_PASSWORD = "myPass"   && Not my real password
>loSendMail.ReplyTo = "lguerra@skynetperu.pe"
>loSendMail.ReplyTo_Name = "Luis Guerra"
>loSendMail.TO = "rpineda@skynetperu.pe"
>loSendMail.TO_Name = ""
>loSendMail.Subject = "Test EMail using VFPWinSock"
>TEXT to loSendMail.Message noshow
>Buena Pnkinkón!!!
>ENDTEXT
>TEXT to loSendMail.MessageHTML noshow
><HTML>
>  <BODY>
>  Buena <STRONG>Test!</STRONG>
>  </BODY>
></HTML>
>ENDTEXT
>loSendMail.CodePage="iso-8859-1"
>loSendMail.Notification = .T. 
>loSendMail.Silence = .F. 
>loSendMail.Priority = "1" &&High
>IF !loSendMail.send() 
> 	MESSAGEBOX(loSendMail.erreur,16,"Error") 
>ENDIF
>loSendMail=NULL
>
Luis,
Please try to make use of an other mailserver, there are numerous free-of-charge mailservers, dont use office365.com,
following code works fine for me, with Port 25
Local loMail As "VFP_Winsock_Send_Mail"
Local lnStartSeconds

With Thisform
	.checkParam()

	Set Procedure To VFPwinsock
	.SendingImage.Visible = .T.
	loMail = Createobject("VFP_Winsock_Send_Mail")
 	loMail.SMTP_HOST =  .cSMTPServer	&&smtp.online.nl
	loMail.From =  .cSender				&&koenpiller@provider.nl
	loMail.From_Name =  .cFromName	&&Koen
	loMail.To =  .cReceiver				&&koen.p@gmail.com
	loMail.Subject =  .cSubject			&&How to send using VFP-WInsock
	loMail.Message =  .cMessage		&&This is a message
	loMail.Attachment =  .cLogfile		&&(None)

	If Not m.oMail.Send()
		Messagebox( ERRORINFO + loMail.Erreur, 0+16+0, TITLETXT, 0 )  &&  OK = 1
	Else
		.SendingImage.Visible = .F.
	Endif

	lnStartSeconds = Seconds()+2
	Do While Seconds()< m.lnStartSeconds

	Enddo
	loMail = Null
Endwith
Regards,
Koen
Previous
Reply
Map
View

Click here to load this message in the networking platform