Home NetLinx Studio

can't handle SMTP function

karageurkarageur Junior MemberPosts: 97
Hi Guys!
We are experiencing problems with sending emails via build-in functions of netlinx - smtp_send & smtp_server_config_set
getting this error: MailSenderPrivate::Send authentication error 4 (Unknown error code)

Tried many services: Gmail, Mail, Yahoo with all settings & ports 25,465,587 with TLS or without.
Even tried our own host email server. No luck!
Does anyone succeeded with mail sending by netlinx - please share the solution?

Regards

Comments

  • viningvining X Member Posts: 4,368
    Yeah that's never seemed to work
    http://www.amxforums.com/showthread.php?9131-smtp-accounts&p=63243#post63243
    I think I read a recent Master FW release note that said they addressed the smtp function so you might want to check it out and see.

    Edit,
    I decided to read the release for 4.1.373 and it does say
    Fixed SMTP_SERVER_CONFIG_SET function to properly save configuration values
    Fixed SMTP_SEND to properly handle the message body text string length
    but unfortunately that's the same FW I was running when I wrote the post in that link above so I fear you're SOL.
  • karageurkarageur Junior Member Posts: 97
    Thanks for answer!
    I'll try to get v.4.1.400 Hot Fix and see what it does
  • JasonSJasonS If I had known it was going to be that kind of party... Posts: 229
    I have successfully used AMX mail in NetLinx and Duet. It does not do any encryption so the server has to have a port open that does not require encrypted connections. It is a bit of a challenge to talk most IT guys into providing.
  • karageurkarageur Junior Member Posts: 97
    JasonS,
    do you mean you've used the same build-in functions - smtp_send?
    I know that standard port for unencrypted mail sending is 25. Are talking about it?
    Could you please explain more detailed?
  • JasonSJasonS If I had known it was going to be that kind of party... Posts: 229
    Port 25 can also be encrypted, and I think it is by default. From what I understand it is a security risk for the port to run unencrypted on the internet because anyone who sends high volumes of spam will be all over it. When I have used smtp_send it has been on a corporate network and they have setup a non standard port to accept the unencrypted connection. I also remember that there is something particular about the from_address field. I don't have my computer with me, but I can post some example code tomorrow.
  • karageurkarageur Junior Member Posts: 97
    That would be very great indeed if you show the example that works!
    Thanks!

    p.s. I have a corp email also with 25 port and without encryption (but with pass of course) - doesn't work with netlinx but works with The bat, outlook and etc.
  • karageurkarageur Junior Member Posts: 97
    I got this from AMX techsupport and it worked!

    DEFINE_DEVICE
    dvMAIL_SERVICE = 0:5:0

    DEFINE_VARIABLE
    SINTEGER MAIL_IDX
    CHAR username[30] = '[email protected]'
    CHAR password[25] = 'password'
    CHAR fromuser[25] = 'AMX NI-3100'
    CHAR sendto[] = '[email protected]'
    CHAR iTLS[] = 'SMTP_TLS_TRUE'
    CHAR server[21] = 'smtp.gmail.com'
    CHAR SMTPport[3] = '587'

    DEFINE_START
    SMTP_SERVER_CONFIG_SET(SMTP_ADDRESS,server)
    SMTP_SERVER_CONFIG_SET(SMTP_PORT_NUMBER,SMTPport)
    SMTP_SERVER_CONFIG_SET(SMTP_USERNAME, username)
    SMTP_SERVER_CONFIG_SET(SMTP_PASSWORD, password)
    SMTP_SERVER_CONFIG_SET(SMTP_FROM, fromuser)
    SMTP_SERVER_CONFIG_SET(SMTP_REQUIRE_TLS, SMTP_TLS_TRUE)

    WAIT 100
    {
    SMTP_SEND(dvMAIL_SERVICE, sendto, 'Test Send Mail','Sent From Define Start',Null_STR)
    }
  • trobertstroberts Member Posts: 228
    karageur wrote: »
    I got this from AMX techsupport and it worked!

    Confirmed. The above example works. I just setup a free gmail account and it worked, however it did not work on a paid yahoo account (aka yahoo plus) I am assuming it is related to the level or type of encryption the email server requires.
    I am running the 4.1.400 hot fix
  • karageurkarageur Junior Member Posts: 97
    I also tested on previous firmware version. It works too.
  • viningvining X Member Posts: 4,368
    karageur wrote: »
    I also tested on previous firmware version. It works too.
    What was the difference between TS's version and your versions that didn't work? What were you doing wrong if it wasn't a FW issue?
  • karageurkarageur Junior Member Posts: 97
    I'm trying to figure it out.
    Gmail was the first tested mail provider.
    And the first thing I checked the SMTP settings - here they are:
    Outgoing Mail (SMTP) Server - requires TLS or SSL: smtp.gmail.com
    Use Authentication: Yes
    Port for TLS/STARTTLS: 587
    So the same settings were used.
    The main difference is that I didn't use intermediate variables, instead I just put the values directly in SMTP_SERVER_CONFIG_SET and SMTP_SEND functions.
    Maybe this was the cause?
  • JasonSJasonS If I had known it was going to be that kind of party... Posts: 229
    This just reminded me what I used to figure out how to make this work. In the AMX "WebConsole & Programming Guide NetLinx Integrated Controllers Firmware Version 4 or Higher" document, Appendix B SMTP Support.
    It does not come right out and say it, but if you look closely at the definition of the function for "SMTP_SERVER_CONFIG_SET" ...
    SMTP_SERVER_CONFIG_SET(CONSTANT CHAR cfgName[], CONSTANT CHAR cfgValue[])
    
    .. you will see that cfgValue[] is a CONSTANT. I remember missing this the first time around. However I do configure SMTP_Server from a structure at startup in most programs.

    Another interesting note, when you use AMX Mail in Duet there is no TLS option. No one at AMX has been able to tell me why.
  • eluyteneluyten Junior Member Posts: 1
    different firmware for DGX systems ?

    Hi,
    It seems you need firmware hot fix v 4.2.393 on a Enova DGX16 system.
    Also check that the SERVER port number is entered as CHAR and not INTEGER.
    I tested this with a server that did not need authentication. Set the SMTP_USERNAME to an empty string ('') and don't set the SMTP_PASSWORD. TLS is set to FALSE.
    Works also with attachments.

    Regards,

    Erik
  • Bruce TurnerBruce Turner Junior Member Posts: 10
    Excellent chunk of code, thanks! Tested successfully with a Gmail e-mail address as the sender, you must enable "Access for less secure apps" in the Gmail account settings, of course, Google will tell you that.

    I'm curious, has anyone used this to send to multiple recipients?
  • trobertstroberts Member Posts: 228
    I'm curious, has anyone used this to send to multiple recipients?

    I have sent to multiple recipients and it works well. I seperated each recipients with a ; in my SMTP_Send string within the " " after the dev #

Sign In or Register to comment.