JavaMe, Send mail via smtp.gmail.com with TLS - email

I am developing the mail client for Cinterion EHS5 device. This device can run javaMe 3.2
I need to send a mail using smtp.gmail.com port 587 with TLS.
For now I am able to send email via smtp.gmail.com with SSL using code like this.
SecureConnection sc =(SecureConnection)Connector.open("ssl://"+this.mailAccount.getSMTPserverAddress() + ":"+this.mailAccount.getSMTPport(),Connector.READ_WRITE, true);
I tried the examples of Blackberry developers and tons of variations to make it work with TLS.
SecureConnection sc =(SecureConnection)Connector.open("tls://"+this.mailAccount.getSMTPserverAddress() + ":"+this.mailAccount.getSMTPport(),Connector.READ_WRITE, true);
Didn't work.
Does anybody know the good approach to solve this problem?
Links, books, examples will be appreciated.

Related

How to find out what SMTP port you are using?

How do i find out what SMTP port the corporation i work for has set up for it's email server?
I've tried searching for it via outlook but it doesn't give me the option.
I'm looking for an answer that i'll be able to do via cmd.
Posting this question here so future individuals who are in my position will know what to do
The default SMTP port for most mail servers is port 25; either that or port 587 if you are using explicit SSL. If you are using implicit SSL, then it is port 465. You should be able to discover the port through Outlook; here is an article: https://www.doteasy.com/domain-email-and-website-hosting-articles/how-to-update-your-smtp-port-ssl-settings-and-smtp-authentication
If like me you work for a large company, the issue is that IT are blocking the ports. You need to go and have a word with the IT department to get it fixed.

SMTP ports on desktop and mobile

For years I used port 465 for my outgoing email with no problem, but suddenly my desktop client (eM Client) refused to send messages. I went to my provider for advice and they claim they haven't changed any settings and it's my client's fault. Hmm... I've changed the port to 587 and it works smoothly now.
But I've noticed that my mobile client (AirMail on iOS) still uses port 465! What's more, when I tried updating it to 587, it stopped working and I had to revert to 465.
So now I have working mail on desktop on port 587 and on mobile on port 465, all with the same provider! It's no real issue, but I can help wondering: what's the real reason for it? Can it be actually attributed to the client software I use?
It would be much easier to provide useful answers if you could provide more details, such as what error responses your clients got from the server when they tried to send email, and what you tried to do to fix the problem.
This is a bit of a wild guess: maybe your desktop is no longer able to send email over a secure (TLS) connection on port 465, but it can send email over an insecure connection on port 587. That might indicate a problem with a certificate.
Indeed! Here's the error message I was getting:
[CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS MULTIAPPEND UNSELECT IDLE CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS ACL RIGHTS=texk QUOTA STARTTLS AUTH=PLAIN AUTH = LOGIN] Dovecot ready.'.
I may be wrong as I have no access to my desktop at the moment but I believe that sending over 587 happens with SSL, at least that's the security set in the account configuration.

Meteor email sending issue

I have a Meteor App that I put on their new Galaxy Platform that throws this error when attempting to send a verification email.
Exception while invoking method 'sendEmailVerificationMessage' Error: Greeting never received
at Object.Future.wait (/app/bundle/programs/server/node_modules/fibers/future.js:398:15)
The Meteor people said that it's an issue with my App but it works just fine both on my testing server and when deployed to Modulus. When checking the email server it never shows any attempt to send email from Galaxy.
My question is, is there any further testing that I can do to see exactly what the problem is, maybe some debugging code that I can add to the code?
process.env.MAIL_URL = 'smtp://' + encodeURIComponent(smtp.username)
+ ':' + encodeURIComponent(smtp.password) + '#'
+ encodeURIComponent(smtp.server) + ':25';
It often hosting provider block SMTP server as it often being abused by user
First, check it with localhost. If it work, then probably Galaxy block SMTP server. Contact them for more info
EDIT
This work with me with Digital Ocean. Haven't test with Galaxy
/*Send Email Through Gmail SMTP*/
process.env.MAIL_URL="smtp://gmailUsername:gmailPassword#smtp.gmail.com:587";
EDIT 2
See here: Gmail SMTP is not working in ec2 instance
Galaxy use AWS EC2, so you should setup AWS SES. Free SMTP include gmail isn't work with AWS
When I set my port to 587 it started working. I'm setting process.env.MAIL_URL inside Meteor.startup() for local/development and seeing no problems. Hope this helps someone!

Symfony framework: How do I send email from localhost?

Using symfony framework how can I send test emails from localhost?
What are most easiest ways?
Thank you!
The easiest way, I suppose and what I normally do, is to configure the _dev environment to use good old Gmail (or any other provider for that matter). Set this up in your apps/frontend/config/factories.yml:
dev:
mailer:
class: sfMailer
param:
logging: %SF_LOGGING_ENABLED%
charset: %SF_CHARSET%
delivery_strategy: realtime
transport:
class: Swift_MailTransport
param:
host: smtp.gmail.com
port: 465
encryption: ssl
username: username#gmail.com
password: your-password
Sending e-mails will ofcourse take a little longer because PHP would have to connect to Google's servers and deliver the message.
This way you can worry about setting up a proper SMTP on your production server, and just let your dev machine be for development. Another advantage is if your develop on the road, and your local cafe / airport / kiosk blocks port 25 (they usually do) you won't have problems delivering mail.
You could install a mail server such as Postfix, and configure it to use an external mail server as an SMTP relay. Otherwise, most email services will either refuse to accept your message, or categorize it as spam.
This thread at serverfault might be helpful to you-it explains how to configure postfix to relay emails through gmail: Configure Postfix to send/relay emails Gmail (smtp.gmail.com) via port 587

Skpsmtpmessage: which server should i use for gmail

I got this project "skpsmtpmessage" and I tried to send mail first. So I changed all the mail id to gmail id. But replay host is problem. I tried smtp.gmail.com, smtp.google.com, smtp.googletalk.com. But when I run my program, I get error that "Unable to connect server"
Which relay host should I use for gmail.
The correct SMTP server for Gmail is smtp.gmail.com, but I don't know how to help you further, the question is pretty vague.
You can also take a look at the configuration instructions for using Gmail on the iPhone to see if you're making a mistake with another parameter.