How to send an E-mail using TC65 ? Part 2 | Telit Cinterion IoT Developer Community
July 21, 2015 - 10:34am, 7033 views
Dear sir.
Acording to varios pdf document it should be easy to send an e-mail.
If I send a at^sisw=9,string-lenght, I get the response -> at^sisw=9,7
^SISW: 9, 7, 0 <- that is ok
Next I aught to send message using -> atcommand.send("at^sisw=" + 9 + "," + e_message + (char) 26 + "\r");
but I get this ->
Exception java.lang.IllegalStateException: Error sending AT Command, ongoing data connection.
So, how to send data as string?
Hello,
Have you also tried to do it without Java?
Here's some example from TC65i AT commands specification:
at^siso=9 // Open the service, i.e. start to send the email.
OK
^SISW: 9,1 //The "^SISW" URC indicates that email data can be transferred.
at^sisw=9,87 //The email to be sent has 87 bytes.
^SISW: 9,87,87 //The write command response confirms that 87 bytes are available for transmission.
Good Morning everyone, we are delighted to
announce our next meeting on Sunday morning.
Write the message text.
OK
at^sisw=9,0,1 //Set the <eodFlag> to mark the end of the email body.
^SISW: 9,0,0 //The <eodFlag> is accepted by the service.
^SISW: 9,2 //The "^SISW" URC confirms that all data is sent successfully.
at^sisi=9 //Check the connection state of the service profile 9.
After you have received "^SISW: 9, 7, 0" the module is in data mode and you should send the data and then OK will be returned. So in Java you would have to open the data output stream for the ATCommand instance you are using. You try to send another command and that's why there's IllegalStateException with information about ongoing data connection.
Regards,
Bartłomiej
I have tryed this:
(string: atcmdresponse defined elswhere)
atcrl = new ATCommandResponseListener() {
public void ATResponse(String Response) {
System.out.println("ATResponseS EG : " + Response);
atcmdresponse = Response;
}
};
atcmdresponse = atcommand.send("at^sisw=" + ispi + "," + e_message.length() + "\r," + atcrl);
But the atcrl newer response, unlike my ATCommandListener listener, which is bound to my SMS-listener as: atcommand.addListener(listener);
Hello,
You have added 'atcrl' to the String.
If you want to use the non-blocking send method you need to pass the listener as second parameter. In that case the method doesn't return any answer but the answer is passed to the listener. The non-blocking send returns immediately and your program will go further without waiting for the answer.
Regards,
Bartłomiej
The problem must be very basic.
My account is: mail.my_domain
But when I test for a connection with AT^SISi=9, I only get a 3 NOT a 4, indicating that there is no connection.
Have You any idea what can be wrong or missing?
Hello,
Please provide the complete log with all the commands with replies you enter to configure the internet access and SMTP service and then open the connection. It will be much easier to help you then.
Regards,
Bartłomiej
AT^SICS=5,conType,"GPRS0"
AT^SICS=5,apn,"internet"
at^siss=9,conId,"5"
at^siss=9,srvType,"smtp"
at^siss=9,smFrom,"morten.bo@oelbye.dk"
at^siss=9,smRcpt,"morten@oelbye.dk"
at^siss=9,smSubj,"Just a test"
at^siss=9,address,"mail.oelbye.dk"
AT^SICS?
^SICS: 0,"conType",""
^SICS: 1,"conType",""
^SICS: 2,"conType",""
^SICS: 3,"conType",""
^SICS: 4,"conType",""
^SICS: 5,"conType","GPRS0"
^SICS: 5,"alphabet","0"
^SICS: 5,"user",""
^SICS: 5,"passwd","*****"
^SICS: 5,"authMode","PAP"
^SICS: 5,"apn","internet"
^SICS: 5,"inactTO","20"0
at^siss?
^SISS: 0,"srvType",""
^SISS: 1,"srvType",""
^SISS: 2,"srvType",""
^SISS: 3,"srvType",""
^SISS: 4,"srvType",""
^SISS: 5,"srvType",""
^SISS: 6,"srvType",""
^SISS: 7,"srvType",""
^SISS: 8,"srvType",""
^SISS: 9,"srvType","Smtp"
^SISS: 9,"conId","5"
^SISS: 9,"alphabet","0"
^SISS: 9,"address","mail.oelbye.dk"
^SISS: 9,"user",""
^SISS: 9,"passwd","*****"
^SISS: 9,"smFrom","morten.bo@oelbye.dk"
^SISS: 9,"smRcpt","morten@oelbye.dk"
^SISS: 9,"smCC",""
^SISS: 9,"smSubj","Just a test"
^SISS: 9,"smHdr",""
^SISS: 9,"tcpPort","25"
^SISS: 9,"smAuth","0"
^SISS: 9,"tcpMR","10"
^SISS: 9,"tcpOT","6000"0
Schyss
Hello,
Thank you for the log.
I can't see what's happening when you open the connection with SISO.
Please check also the internet connection state with AT^SICI?
I can't see that you enter user and password for your SMTP server - dosn't it require any?
Please also see this example:
at^siss=9,srvType,"Smtp" //Select service type SMTP.
OK
at^siss=9,alphabet,"1" //Choose ASCII alphabet.
OK
at^siss=9,conId,"1" //Select connection profile 1.
OK
at^siss=9,address,"192.168.1.2" //Specify SMTP server address.
OK
at^siss=9,user,"user_name" //Specify sender's user name required for SMTP authentication.
OK
at^siss=9,passwd,"password" //Specify password used by the sender for SMTP authentication.
OK
at^siss=9,smFrom,"subscriber1@testdomain.com" //Sender's email address.
OK
at^siss=9,smRcpt,"subscriber2@testdomain.com" //Recipient's email address.
OK
at^siss=9,smSubj,"Meeting Request Sunday Morning" //Enter text for subject field.
OK
at^siss=9,smAuth,"1" //Sender name and password can be used for SMTP authentication.
OK
Please try to follow this example and paste also the log for opening the connection.
Regards,
Bartłomiej
Just for clarity, the sim is an m2m mobilintelligens abonnement.
It does not requere any login. It is open.
I didn't mean login and password for APN to connect to the internet but for the mail server - mail servers require to login to send or receive emails from your account.
AT^SICS?
^SICS: 5,"conType","GPRS0"
^SICS: 5,"alphabet","0"
^SICS: 5,"user",""
^SICS: 5,"passwd","*****"
^SICS: 5,"authMode","PAP"
^SICS: 5,"apn","internet"
^SICS: 5,"inactTO","20"0
at^siss?
^SISS: 9,"srvType","Smtp"
^SISS: 9,"conId","5"
^SISS: 9,"alphabet","0"
^SISS: 9,"address","192.168.1.2"
^SISS: 9,"user","user@user.dk"
^SISS: 9,"passwd","*****"
^SISS: 9,"smFrom","user@user.dk"
^SISS: 9,"smRcpt","user@user.dk"
^SISS: 9,"smCC",""
^SISS: 9,"smSubj","Just a test"
^SISS: 9,"smHdr",""
^SISS: 9,"tcpPort","25"
^SISS: 9,"smAuth","0"
^SISS: 9,"tcpMR","10"
^SISS: 9,"tcpOT","6000"0
Here open:
AT^SISO=9
0
^SISW: 9, 1
AT^SISI=9
^SISI: 9,3,0,0,0,00
AT^SISI=9
^SISI: 9,3,0,0,0,00
AT^SISI=9
^SISI: 9,3,0,0,0,00
Provoking a response
at^sisw=9,99
^SISW: 9, 99, 0
0
And issue a close ->
^SIS: 9, 0, 400, "SMTP protocol error (501): 5.5.2 <morten@oelbye.dk>... Domain name required"
Pages