Internet PLC Forum

General => Technical support => Topic started by: secs on January 14, 2012, 01:18:46 AM

Title: problem with email F2424
Post by: secs on January 14, 2012, 01:18:46 AM
Hi all.
I managed to get the email sending to work at some stage but it has been out of action for a while now. I need or would like to get it up again. My code is basicaly a copy of the exaple

' This function sends out an email to the address specified in the tag
' The SMTP server must be defined correctly using the Ethernet Configuration Tool
' provided by i-TRiLOGI version (6.3x or higher) software.
' ==============================================================

SETLCD 0,0,CHR$(1)  ' clear LCD screen

PRINT #4 "<EMAIL alarm@secs.net.au>" ' replace with your destination email
PRINT #4 "SENDER: plc1@secs.net.au"   ' should be a valid server address
PRINT #4 "SUBJECT: Your power has failed"
PRINT #4 "</>"      ' end the email.

Call rdComm4

SETLCD 1,1,"Email Response Code:" +STR$(date[3]) + ":" + STR$(date[2]) + " - " + STR$(TIME[1]) + ":" + STR$(TIME[2]) + ":" + STR$(TIME[3])
SETLCD 2,1, A$
SETLCD 3,1, STR$(date[3]) + ":" + STR$(date[2]) + " - " + STR$(TIME[1]) + ":" + STR$(TIME[2]) + ":" + STR$(TIME[3])
S = status(3) ' Status(3) = 1 if successful, 0 if failed.


and the rdcomm

' This function read a CR-terminated string received from COMM1 and
' the returned string is stored in A$.
'===================================================================

FOR I = 1 to 10000
   A$ = INPUT$(4)
   IF LEN(A$) <> 0 RETURN: ENDIF
NEXT


but no matter what, I get an error saying
err:04-not connected

Now I can see the log file of the mail server and it shows the system trying to connect and it doesnt say its not allowed or anything. I need some ideas guys to try.
Peter
Title: Re:problem with email F2424
Post by: support on January 15, 2012, 01:02:22 AM
The <EMAIL> tag makes some assumption about the way it will interact with the SMTP server and perform no authentication. If the SMTP server requires authentication then may not work.

We have a FAQ thread discussing how to use the <TCPCONNECT> tag to directly interact with the SMTP server and provide authentication. You can download an example and that will give you more visibility of what happens after the PLC make a connection to your SMTP server:

http://www.tri-plc.com/yabbse/index.php?board=2;action=display;threadid=1608