Need Help: SMTPSocket issue

I have two web programs that run in different domains that are hosted on the same server.
Let’s call these Domains DA & DB.
Program A runs in DA and Program B runs in DB. Both are compiled with RB2013.r2 (WE).
The server is a Linux server.
I have another Domain that is hosted on another server - let’s call that DC. I leverage this domain to generate emails.

I have the code below for the same function (user feedback) in both Program A and Program B.
When executed on the server - Program A works fine, and I receive the email as expected. However, for Program B I never receive the email. Any clues as to what might be different?

Below is the IDENTICAL code that exists in both Program A and Program B.
I think there might be a timing issue - and perhaps I need to access the SMTPSocket events - but I can’t recall how to instantiate the class in Xojo WE to get access to the events of this class. Advice there is welcome also.

Dim sm As New SMTPSocket
sm.address = “DC.com
sm.port = 25
sm.username = “support@DC.com
sm.password = “DCPW”

Dim Mail As New EmailMessage
mail.fromAddress=UserEmail
mail.subject=“user feedback”
mail.bodyPlainText = TextArea1.Text

mail.addRecipient Trim(“support@DC.com”)
sm.messages.append mail
sm.SendMail

[quote=36648:@Mark Pastor]I have two web programs that run in different domains that are hosted on the same server.
Let’s call these Domains DA & DB.
Program A runs in DA and Program B runs in DB. Both are compiled with RB2013.r2 (WE).
The server is a Linux server.
I have another Domain that is hosted on another server - let’s call that DC. I leverage this domain to generate emails.

I have the code below for the same function (user feedback) in both Program A and Program B.
When executed on the server - Program A works fine, and I receive the email as expected. However, for Program B I never receive the email. Any clues as to what might be different?

Below is the IDENTICAL code that exists in both Program A and Program B.
I think there might be a timing issue - and perhaps I need to access the SMTPSocket events - but I can’t recall how to instantiate the class in Xojo WE to get access to the events of this class. Advice there is welcome also.

Dim sm As New SMTPSocket
sm.address = “DC.com
sm.port = 25
sm.username = “support@DC.com
sm.password = “DCPW”

Dim Mail As New EmailMessage
mail.fromAddress=UserEmail
mail.subject=“user feedback”
mail.bodyPlainText = TextArea1.Text

mail.addRecipient Trim(“support@DC.com”)
sm.messages.append mail
sm.SendMail[/quote]

Sounds like Domain relay issue

Check you mail server is allowed to sent emails from the other domains.

I thought of that - but if that were the case I would expect that Program A (on MainServer) would have the same problem as Program B (on MainServer) in sending emails from Domain C (on OtherServer). But Program A works. Still a mystery to me.

  1. Can you see anything in your mail log ?
  2. Try this on your mail server if you have TcpDump installed: “tcpdump -i eth0 port 25” and see if you manage to get a connection, when you run your application.

eth0 is you network card. If it has a different name you need to replace it with correct name. You can check that by enter: “ifconfig -a” as root or “sudo ifconfig -a”

or the possibilities to run wireshark (http://www.wireshark.org/) on your mail server

Most likely a timing issue, as your socket is going out of scope before SendMail can finish. Make the socket more global in scope. Add it to the webpage or put it in a session variable.

Thanks Tim - that is along the lines of what I was thinking.

As I mentioned above, I can not recall how to instantiate (in design time) an SMTPSocket in WE - either as a property of a session or as an object on a page.

Can you (or someone) remind me how to do that.

Could also be postfix.

For instantiation I was able to figure out how to add to modules, pages etc. by adding a Class and calling up the appropriate SuperClass - not sure if that is the best way. Please advise if there are better approaches.