Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Emailing With Winsock - Error
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01115512
Message ID:
01115724
Vues:
10
Ok, but that doesn't answer the question of how to authenticate myself
to the server...





>Hi Kevin...
>
>SMTP server doesn't commands USER and PASSWORDS.
>
>SMTP commands and RFC
>
>MartinJ
>
>>I'm trying to create a small form to send an email using Winsock.
>>The form is here http://www.marois-consulting.com/stuff/emailform.zip
>>
>>In the code below, the line with the arrow causes Comcast to respond with:
>>
>>250 comcast.net
>>530 Authentication required
>>
>>
>>The next line after that causes Comcast to respond with:
>>
>>500 Command unrecognized
>>
>>
>>My guess is that I am not sending the right commands to login. I'm open to any suggestions.
>>Thanks
>>
>>
>>
>>
>>#INCLUDE winsockdemo.h
>>
>>LOCAL nPauseCounter, cRetVal, cUserName, cPassword, cServerName
>>LOCAL cUserName, cPassword, cSender, cRecipient, cSubject, cMsgBody
>>nPauseCounter = 0
>>
>>
>>DECLARE Sleep ;
>>	IN Win32API;
>>	INTEGER nMilliSeconds
>>
>>
>>WITH ThisForm
>>
>>	** Clear the status box and the log
>>	.txtStatus.Value 	= ""
>>	.edtLog.Value 		= ""
>>
>>	** Get values from the form
>>	cServerName		= ALLTRIM(.txtServerName.Value)
>>	cUserName			= ALLTRIM(.txtUserName.Value)
>>	cPassword			= ALLTRIM(.txtPassword.Value)
>>	cSender  			= "<" + ALLTRIM(.txtFromAddress.Value) + ">"
>>	cRecipient		= "<" + ALLTRIM(.txtToAddress.Value) + ">"
>>	cSubject			= ALLTRIM(.txtSubject.Value)
>>	cMsgBody			= ALLTRIM(.edtBodyText.Value)
>>
>>	** Set up the winsock control
>>	.oWinSock.Protocol 		= PROTCOL_TCP
>>	.oWinsock.RemoteHost 	= cServerName
>>	.oWinsock.LocalPort 	= LOCAL_PORT
>>	.oWinsock.RemotePort 	= REMOTE_PORT
>>
>>	** Attempt to connect
>>	.oWinsock.Object.Connect()
>>	
>>	** Pause for half a second
>>	=Sleep(nSleepDelay)
>>	
>>	** Display a message
>>	.edtLog.Value = .edtLog.Value + "Waiting for socket to be connected.." + CRLF
>>	
>>	** If not connected, pause while a connection is attempted
>>	DO WHILE .oWinsock.State # sckConnected AND nPauseCounter <= 10
>>		=INKEY(.5)
>>		nPauseCounter = nPauseCounter + 1
>>	ENDDO
>>	
>>	** If the socket is connected...
>>	IF .oWinsock.State = sckConnected
>>
>>		** Initiate connection and login to the mail server
>>		cRetVal = .SendSMTPData("HELO kevin@marois-consulting.com")
>>		cRetVal = .SendSMTPData("MAIL FROM:" + cSender)                && <==========
>>		cRetVal = .SendSMTPData("USER:" + cUserName)
>>		cRetVal = .SendSMTPData("PASS:" + cPassword)
>>		cRetVal = .SendSMTPData("RCPT TO:" + cRecipient)
>>		cRetVal = .SendSMTPData("DATA")
>>
>>		** Format the mail message
>>		cRetVal = .SendSMTPData("From:" + + ALLTRIM(.txtFromAddress.Value), TRUE)
>>		cRetVal = .SendSMTPData("To:" + ALLTRIM(.txtToaddress.Value), TRUE)
>>		cRetVal = .SendSMTPData("Subject: " + cSubject, TRUE)
>>		cRetVal = .SendSMTPData("", TRUE)
>>		cRetVal = .SendSMTPData(cMsgBody, TRUE)
>>		cRetVal = .SendSMTPData(".", TRUE)
>>		
>>		** Finish the connection
>>		cRetVal = .SendSMTPData("QUIT")
>>		
>>	ELSE
>>		.edtLog.Value = .edtLog.Value + "Unable to send mail Socket State " + STR(.oWinsock.State,2) + CRLF
>>		.edtLog.Refresh
>>	ENDIF
>>	
>>ENDWITH
>>
>>CLEAR DLLS
>>
>>RETURN
>>
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform