Sending Email in Java using AT Commands - Doesnt send - RESOLVED. | Telit Cinterion IoT Developer Community
February 25, 2018 - 3:06pm, 3053 views
Hi,
Has anyone been able to have any success properly configuring a connection and service profile to send an email using AT Command in Java?
I have attempted this using Yahoo SMTP server but am finding the email does not come through to the nominated address.
Here's a paste code of what I attempted:
When I run the individual commands using a terminal, the email sends just fine.
But in Java, it just doesnt work the way it works when I typically use the AT commands to send an SMS (which works just fine).
Does anyone have any tips or a working basic example of being able to send the email using the AT commands via Java?
Many thanks.
Nick.
UPDATE - It's OK I got it working again. Please feel free to ask if you need example.
Hello,
Could you, please, write a short information about what the problem was?
Thanks,
Bartłomiej
Hi Bartlomiej,
Of course. The Java code did function as expected.
The problem was I had forgotten to attach a PDP via the following prior to running the Java program.
When I start my EHS6T, I find I have to open a terminal and input the following commands:
1. AT+CGDCONT=1,"ip","live.vodafone.com" (or as per your sim card carrier's apn).
2. AT+CGACT = 1,1 (to attach that IP into a PDP).
3. AT+CGPADDR (To check the ip address I am dynamically signed to, and also to check if one was assigned). e.g if you get 10.x.x.x or somesuch IPv4.
So in short once there was a connection, I could set the connection and service profiles I needed and open the service for my email sending code :)
Hello,
Thank you for your reply.
Generally if you are using IP services over AT commands in EHS6 module (configured with AT^SISS command) you should configure internet connection profile with AT^SICS and should not need to use AT+CGDCONT for this. And I believe that this should work the same way regardless if you run it on the physical port or from Java code.
Or maybe we are talking about different things.
Regards,
Bartłomiej
Hi Bartlomiej,
I believe you could be right. In the previous case of working with an Optus phone sim with optional data, we found that simply configuring a mobile connection would not provide us with an assigned IP..therefore no mobile network at all. The extra steps from 1 - 3 above were provided to us from the local Gemalto here in Australia as a possible means to rectify that problem. It worked.
But since we have swapped out to a Vodafone sim, everything now works. Even all the services like FTP SMTP and HTTP. So it may have just been a problem with the sim card we were using.
We tried this with physical port in terminal and in Java. We may be able to now get rid of those extra AT commands and run just with connection profile only.
We'll keep you posted.
Regards,
Nick.
Hi Nick,
Thank you for these additional clarifications. Now everything is clease.
So it was a workaround for a somehow specific SIM card. Maybe it will help somebody with the similar problem.
Best regards,
Bartłomiej