FoxPro Programming
smtp email
Gravatar is a globally recognized avatar based on your email address. smtp email
  Marino Stathakis
  All
  Feb 4, 2021 @ 11:59am

No matter what I do (and I'm working with a network administrator) in trying to get the smtp to work, I continue to get "2021.02.4 09:59:34:366 - rec: 504 5.7.4 Unrecognized authentication type"

Here's the code:

do wwSmtp
loSmtp = CREATEOBJECT("wwSmtp")

 ** On the cMailSesrver, tried no ports (25, 2525, and others provided by admin)
loSmtp.cMailServer = "remote.domain.com:2525"
loSmtp.cSenderEmail = "develop@domain.com"
loSMtp.cSenderName  = "companyName - Department"
losmtp.cusername = 'develop@domain.com'
losmtp.cpassword = 'password'
** Optional SSL/TLS connection
*loSmtp.LUseSsl = .T.

losmtp.clogfile = 'm:\apps\aei\fax\wwsmtpWithTLSlog_0959.txt'
losmtp.cRecipient = 'emailAddress@tx.rr.com'
losmtp.cSubject = 'smtp Send test'
losmtp.cContentType = 'text/html'
losmtp.cMessage = 'This is a test sending from smtp'
*** Optionally provide an alternate content type or plain text fallback
loSmtp.cAlternateContentType = "text/plain"
loSmtp.cAlternateText = "Plain text can go here."

IF !loSmtp.SendMail()
	wait window loSmtp.cErrorMsg
	RETURN
ELSE
	wait wind 'SENT'	
ENDIF
Gravatar is a globally recognized avatar based on your email address. Re: smtp email
  Rick Strahl
  Marino Stathakis
  Feb 4, 2021 @ 01:56pm

Does the server require SSL/TLS? If so you need to set that flag and ensure you're using the .NET handler (which I think is the default now).

Could also be that the server is using not an SMTP/ESMTP server, but an IMAP server in which case this class won't work.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. Re: smtp email
  Marino Stathakis
  Rick Strahl
  Feb 4, 2021 @ 02:06pm

I was working with the network admin and was flipping the lUseSsl both ways with various port to no avail.

When you say, "ensure you're using the .NET handler (which I think is the default now).", is that to set the nMailMode = 2 ?

Gravatar is a globally recognized avatar based on your email address. Re: smtp email
  Rick Strahl
  Marino Stathakis
  Feb 4, 2021 @ 03:16pm

.NET Mode is .nMailMode = 0 which is NOT the default. Just checked now - but I'm going to switch that to 0 as the default, since these days it seems every server requires TLS. Mode 0 doesn't break behavior so that should be safe even for existing apps.

Sending SMTP Email

Gravatar is a globally recognized avatar based on your email address. Re: smtp email
  Marino Stathakis
  Rick Strahl
  Feb 4, 2021 @ 03:20pm

Yea, sorry Rick, I meant to post a parameter of '0';

When I use the .NET mode, it's throwing all kinds of errors. Is there something I can/should do with insuring .net libraries are in place and are accessible?

Gravatar is a globally recognized avatar based on your email address. Re: smtp email
  Rick Strahl
  Marino Stathakis
  Feb 4, 2021 @ 03:26pm

What type of errors?

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. Re: smtp email
  Marino Stathakis
  Rick Strahl
  Feb 4, 2021 @ 04:04pm

Unknown member ODOTNETBRIDGE

this.oDotNetBridge.LoadAssembly("System")	
Gravatar is a globally recognized avatar based on your email address. Re: smtp email
  Rick Strahl
  Marino Stathakis
  Feb 4, 2021 @ 05:57pm

What version of Client Tools and what version of Windows?

I'm not sure how that's possible given the code that runs. There should be an error thrown before you get to that code.

IAC you need to have .NET 4.5 or later on the machine. For Windows XP and 7 that means it has to be installed. It doesn't work on Windows XP.

+++ Rick ---

© 1996-2021