PDA

View Full Version : ESMTP



Reinking
16-06-2005, 23:35
How do you make the Test_SMTP.tBasic script speak ESMTP :?:

ErosOlmi
17-06-2005, 00:58
SMTP module uses SMTP library from MarshallSoft. See http://www.marshallsoft.com SEE4PB library.
All that library can do, thinBasic can do. See library manual at http://www.marshallsoft.com/see_ref.htm

I still have to document into help SMTP module in details but will be soon ready.

More, I've used only few part of SEE4PB library potentiality. As you can see from the help at the above link, I can activate ESMTP authentication but I've not yet integrated it into thinBasic module.

There are so many things to do ...

We are also thinking to add a new additional module before releasing thinBasic: TCP/UDP. With this module you will be able to connect directly to any host using whatever protocol you need.

Ciao
Eros

Teknix
11-09-2009, 02:55
I'm confused about SMTP_SetOption. Judging by the log below, SetOption appears to only be valid for numeric parameters, but I don't see an equivalent option for the string parameters needed for ESMTP authentication. What am I missing? The email host is 1&1, the USA arm of Germany's Schlund.

I'm running the following test script:

Uses "SMTP"
DIM RetCode AS LONG
RetCode = SMTP_SetLogFile("smtplog.txt")
RetCode = SMTP_SetOption(%SMTP_ENABLE_ESMTP, 1)
RetCode = SMTP_SetOption(%SMTP_SET_USER, "mark@domain.com")
RetCode = SMTP_SetOption(%SMTP_SET_SECRET, "pop-password")
RetCode = SMTP_SetOption(%SMTP_AUTHENTICATE_PROTOCOL, %SMTP_AUTHENTICATE_PLAIN)
RetCode = SMTP_Connect("smtp.1and1.com", "Mark<mark@domain.com>", "Mark<mark@domain.com>")
RetCode = SMTP_SendEMail("MarkBB<cell-phone@vtext.com>","","","Testing","","",0)
RetCode = SMTP_Close

And getting the following log:

*** seeIntegerParam(0,29,1)
*** seeIntegerParam(0,58,0)
*** seeIntegerParam(0,57,0)
*** seeIntegerParam(0,62,4)
*** seeIntegerParam(0,9,1)
*** seeSmtpConnect
<200:1442346765>
VS Win32 Version 1.1.2 Build 4
SEE Win32 Version 3.6.13 Build 8
Erbolario
CID=5937
<101:1442346765>
vSocket: 0 created
<102:1442346775>
LocalHost = 'my-pc'
<104:1442346845>
Server = 'smtp.1and1.com'
ServerIP = 74.208.5.2
<105:1442346845>
Socket=132, RemoteIP=4ad00502, RemotePort=25
<106:1442346975>
<201:1442347005>
R: 220 smtp.perfora.net (mrus0) Welcome to Nemesis ESMTP server
<202:1442347095>
S: EHLO domain.com
<203:1442347346>
R: 250-smtp.perfora.net
R: 250-STARTTLS
R: 250-AUTH LOGIN PLAIN
R: 250-AUTH=LOGIN PLAIN
R: 250-PIPELINING
R: 250-SIZE 120000000
R: 250 HELP
<170:1442347436>
S: AUTH PLAIN JCQNCg==
<171:1442347486>
R: 535 no authentication identity in decoded response
ERROR(1442347486): SockCode=0 SeeCode=-49 PrevState=171 ThisState=171 NextState=171
SMTP returned error. 535 no authentication identity in decoded response
*** seeSendEmail
*** Sending...
<204:1442347486>
S: MAIL FROM:<mark@domain.com>
<205:1442347516>
R: 250 OK
<206:1442347546>
<207:1442347546>
S: RCPT TO:<cell-phone@vtext.com>
<208:1442347546>
R: 550 must be authenticated
ERROR(1442349619): SockCode=0 SeeCode=-49 PrevState=208 ThisState=208 NextState=208
SMTP returned error. 550 must be authenticated
*** seeIntegerParam(0,9,1)
*** seeClose
<258:1442349619>
S: QUIT

ErosOlmi
11-09-2009, 07:59
Teknix,

well, you are right. It is not possible to pass string parameters to SMTP module.
But I've implemented a string parameter function to allow this.
I've developed "SMTP_SetOptionStr" function for this purpose.

Get attached thinBasic_SMTP.dll and copy to your \thinBasic\Lib\ directory replacing your current one.

Use something like the following example:

Uses "SMTP"

DIM RetCode AS LONG

RetCode = SMTP_SetLogFile("smtplog.txt")
RetCode = SMTP_SetOption(%SMTP_ENABLE_ESMTP, 1)
RetCode = SMTP_SetOption(%SMTP_AUTHENTICATE_PROTOCOL, %SMTP_AUTHENTICATE_LOGIN) '---Check also %SMTP_AUTHENTICATE_PLAIN
RetCode = SMTP_SetOptionStr(%SMTP_SET_USER, "user@domain.com") '---Change user as needed
RetCode = SMTP_SetOptionStr(%SMTP_SET_SECRET, "userpassword") '---Change password as needed
RetCode = SMTP_Connect("smtp.1and1.com", "Mark<mark@domain.com>", "Mark<mark@domain.com>")
RetCode = SMTP_SendEMail("MarkBB<cell-phone@vtext.com>","","","Testing Subject","This is a text message body.","",0)
RetCode = SMTP_Close

Let me know if now is ok.
Eros

Teknix
12-09-2009, 04:23
Works great! Thanks for your prompt reply and quick fix!

Mark Hermanson
Iowa - USA