RestComm / Restcomm-Connect

The Open Source Cloud Communications Platform
http://www.restcomm.com/
GNU Affero General Public License v3.0
244 stars 215 forks source link

Email Fails on Cloud but works when Using API #2903

Open croufay opened 6 years ago

croufay commented 6 years ago

If you create an App in RVD that sends email, you get the following error.

1855971:21:35:16,151 ERROR [org.restcomm.connect.email.EmailService] (RestComm-akka.actor.default-dispatcher-4768) failed to connect, no password specified? WARNING arguments left: 1 1855972:21:35:16,151 ERROR [org.restcomm.connect.sms.smpp.SmppInterpreter] (RestComm-akka.actor.default-dispatcher-4762) There was an error while sending an email :failed to connect, no password specified?: javax.mail.AuthenticationFailedException: failed to connect, no password specified? 1855973- at javax.mail.Service.connect(Service.java:329) [mail-1.4.5.jar:1.4.5] 1855974- at javax.mail.Service.connect(Service.java:176) [mail-1.4.5.jar:1.4.5] 1855975- at javax.mail.Service.connect(Service.java:125) [mail-1.4.5.jar:1.4.5] 1855976- at javax.mail.Transport.send0(Transport.java:194) [mail-1.4.5.jar:1.4.5] 1855977- at javax.mail.Transport.send(Transport.java:124) [mail-1.4.5.jar:1.4.5] 1855978: at org.restcomm.connect.email.EmailService.send(EmailService.java:191) [restcomm-connect.email-8.3.2-199.jar:8.3.2-199] 1855979: at org.restcomm.connect.email.EmailService.onReceive(EmailService.java:144) [restcomm-connect.email-8.3.2-199.jar:8.3.2-199] 1855980- at akka.actor.UntypedActor$$anonfun$receive$1.applyOrElse(UntypedActor.scala:159) [akka-actor_2.10-2.1.2.jar:] 1855981- at akka.actor.ActorCell.receiveMessage(ActorCell.scala:425) [akka-actor_2.10-2.1.2.jar:] 1855982- at akka.actor.ActorCell.invoke(ActorCell.scala:386) [akka-actor_2.10-2.1.2.jar:] 1855983- at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:230) [akka-actor_2.10-2.1.2.jar:] 1855984- at akka.dispatch.Mailbox.run(Mailbox.scala:212) [akka-actor_2.10-2.1.2.jar:] 1855985- at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:506) [akka-actor_2.10-2.1.2.jar:] 1855986- at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:262) [scala-library-2.10.1.jar:] 1855987- at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975) [scala-library-2.10.1.jar:] 1855988- at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1478) [scala-library-2.10.1.jar:] 1855989- at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104) [scala-library-2.10.1.jar:]

If you use the API to send the email like the one below, it works.

curl -X POST https://ACf0038edcdbcfab8139bf5b02f7f63e4a:PWD@cloud.restcomm.com/restcomm/2012-04-24/Accounts/ACf0038edcdbcfab8139bf5b02f7f63e4a/Email/Messages.json -d "To=charles.r@domain.com" -d "From=info@telestax.com.com" -d "Body=This is a test from RestComm" -d "Subject=Test Email" { "date_sent": "2018-04-07T02:47:39.622Z", "account_sid": "ACf0038edcdbcfab8139bf5b02f7f63e4a", "from": "info@telestax.com.com", "to": "charles.r@domain.com", "body": "This is a test from RestComm", "subject": "Test Email" }

croufay commented 6 years ago

email sent from RVD is not using SSL and is also missing the pwd

https://github.com/RestComm/Restcomm-Connect/blob/master/restcomm/restcomm.email/src/main/java/org/restcomm/connect/email/EmailService.java#L191

croufay commented 6 years ago

I tried locally and restcomm defaults to port 25

TP host: localhost, port: 25 WARNING arguments left: 1 15:24:04,355 INFO [org.restcomm.connect.interpreter.VoiceInterpreter] (RestComm-akka.actor.default-dispatcher-65) ** VoiceInterpreter's akka://RestComm/user/$f/$g Current State: sending Email , Processing Message: org.restcomm.connect.email.api.EmailResponse Sender is: akka://RestComm/user/$f/$g/$e 15:24:04,355 ERROR [org.restcomm.connect.interpreter.VoiceInterpreter] (RestComm-akka.actor.default-dispatcher-65) There was an error while sending an email :Could not connect to SMTP host: localhost, port: 25 WARNING arguments left: 1

croufay commented 6 years ago

Local using port 25 was a config issue after updating the restcomm.xml file to use the same email smtp server as cloud and I created an RVD app on my local restcomm instances, email worked as expected.