West Wind Internet and Client Tools
wwSMTP Encryption Question
Gravatar is a globally recognized avatar based on your email address. wwSMTP Encryption Question
  John
  All
  Jul 25, 2022 @ 11:18am

My email server host has setup encryption on the email accounts that I am sending out reports through, they just did so this weekend with no warning. They say I should be using STARTTLS for the encryption, though with another tool I use I noticed I was able to successfully use TLS set to Explicit. I found the settings which refer to using SSL/TLS and set that to .t., but am still unable to connect to the server – it is just saying connection refused. I have just upgraded to the latest version 7.27 but am still getting the same result. What is my solution, or next step to figuring this out? Thanks.

Gravatar is a globally recognized avatar based on your email address. re: wwSMTP Encryption Question
  John
  John
  Jul 25, 2022 @ 11:37am

Here is the code I am using:

*** Build and Send eMail
LOCAL loSmtp 

			
*** Load required libraries
DO wwSmtp 
		
LOCAL loSmtp as wwSmtp
loSmtp = CREATEOBJECT("wwSmtp")
			
*** Select mail mode. 0 - .NET wwSmtp   2 - Classic wwIPstuff 
*** Note: Mode 2 only supports SendMail and SendMailAsync
***       and no support for alternate views
**loSmtp.nMailMode = 2
loSmtp.nMailMode = 0

*** DeliveryList.net Email Server
loSmtp.cMailServer = "netsol-smtp-oxcs.hostingplatform.com"
			
*** Timeout in seconds
loSmtp.nTimeout = 25

*** Optionally use SSL/TLS if the mail server requires it
loSmtp.lUseSsl = .T.
			
*** specify user name and password
loSmtp.cUsername = "UserName"
						
loSmtp.cPassword = "Password"

loSmtp.cSenderName= "SenderName"
			
loSmtp.cSenderEmail = "NoReply_DeliveryList@Domain"
				
loSmtp.cRecipient = (m.recipientList)

*** Actual message properties
loSmtp.cSubject = m.RptFileName
loSmtp.cMessage = m.Client + ", file attached: " + m.RptFileName

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

*** Optional properties
*loSmtp.cReplyTo = "NoReply@Domain"
loSmtp.cPriority = "Normal"

*** To add attachments use Attachment and point at a full file path
loSmtp.AddAttachment((m.RptPathFileName))

*** Add any custom headers that properties don't cover
loSmtp.AddHeader("x-mailer",(m.AppName))


*** Single Mail Sending - connect/disconnect for message
llResult = loSmtp.SendMail()
			
IF llResult
   	WAIT WINDOW "Mail sent..." 
ELSE
	WAIT WINDOW "Mail sending failed: " + loSmtp.cErrorMsg
ENDIF
Gravatar is a globally recognized avatar based on your email address. re: wwSMTP Encryption Question
  Rick Strahl
  John
  Jul 25, 2022 @ 12:27pm

Probably the wrong port. If using SSL/TLS the port is almost always something other than the default port of 25 which is the non-encrypted port.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: wwSMTP Encryption Question
  John
  Rick Strahl
  Jul 25, 2022 @ 12:33pm

Thanks Rick, I noticed I didn't specify the port in the loSMTP.cMailServer entry that I posted, sorry, this is what I have been using which should set the port, correct? "netsol-smtp-oxcs.hostingplatform.com:587"

Gravatar is a globally recognized avatar based on your email address. re: wwSMTP Encryption Question
  Rick Strahl
  John
  Jul 25, 2022 @ 12:35pm

Yes provide the port on the server name.

Also - try sending without the file first to make sure that works before hooking up the the attachment.

+++ Rick ---

© 1996-2022