How to send Email to every host in scala play framework? - scala

Right now, i am able to send my email to current host where i have declared in the scala code application.conf
smtp.host=apps.hubino.com, smtp.port=25
but i am unable to send my mail to other host like gmail and yahoo. Can anyone help me how to achieve sending mails to every host in scala.

I am sending email through google smtp server with these configuration.
smtp.host=smtp.gmail.com
smtp.port=465
smtp.ssl=yes
smtp.user=“********#gmail.com"
smtp.password=“**********"
This should work. Also if you make small changes in host and port you should be able to send email to any other smtp servers.
Which scala plugin you are using to send email? You can check MailerPlugin of Play or Courier plugin. Both are very simple to use.
And first time google will block sending email through you application as it is less secured so you need to make changes in your gmail account settings to allow sending email through less secure clients. This link can help you do that or else if you try to send email without making these setting you will received email from google saying securing 'Blocked sign-in attempt' which will contain URL to make changes in your account setting to allow sending email through api client.

Related

How to identify whether Google SMTP server has been blocked when used by an application to send emails

My web application sends email to users on certain business events. For this im using a Google SMTP server with both username password mode as well as OAuth 2.0.
Other props are as follows :
smtpHost: smtp.gmail.com
smtpPort: 587
Now the issue is, after some emails being marked as spams Google blocks the domain and the account. Is there a way to avoid happening this? And is there a way to identify the error thrown when tries to send the email when the domain is blocked, so I can create an alert about the domain and account being blocked.. For now its not possible to access the past logs either, but can get access to the new logs. Suggestions would be highly appreciated.

Mailbox unavailable. The server response was: This domain is not hosted here

I am performing some tests on my Nopcommerce site that should allow the user to type a message in to the contact box of the site and that message should be sent by email to a user.
When setting up and testing said user on the site, I am able to perform an email test against an internal email address and this works fine, I receive the email. However, if I try and send the email to an external email address, such as hotmail etc, I receive no error logs at all.
Has anyone ever come across this issue when trying to set up an email on a Nopcommerce site?
I am using port 25 however I have tried to use port 587 with no luck
The answer was that the username and password no longer existed for the server I was sending mail from. Moreover, another issue I had was that the mail still wasn't sending and was sitting in the Message queue. To overcome this I had to make sure that the bindings for the site on IIS were identical to the host values on the site. Doing this allowed me to send mail.

Sending email from GCE or AWS on behalf of users

How could I use Google Compute Engine (or a similar service, like AWS) to send email on behalf of users via their SMTP server?
I am interested in building an online email client which allows users to enter their SMTP and POP servers and send/receive email, like they would with their desktop clients. GCE blocks all SMTP ports to prevent abuse and recommends using a mail service like SendGrid instead. However, after researching dozens of these services, they all seem to only support transactional email using their own SMTP servers, or possibly a pre-cleared smtp server. I simply want to send email using the user's SMTP server (ex smtp.mail.yahoo.com), just like they would if they were using a desktop client.
I realize I could host my own servers but I am not interested in maintaining the infrastructure. I would like to host everything on a cloud service. Is there any way I can work around Google's restrictions with an existing service?
As I'm sure you are aware, you would have to have the user enter their SMTP server information and account credentials. You would then use that information to connect to their SMTP server.
By default AWS EC2 instances have SMTP traffic on port 25 rate limited. To remove this limitation, you would need to fill out and submit the following form:
https://aws-portal.amazon.com/gp/aws/html-forms-controller/contactus/ec2-email-limit-rdns-request
If you're looking to send mail as a Gmail, Hotmail, or Yahoo user, you'll probably want to call the service's API to have the server send mail on the user's behalf. There are several benefits of this:
You'll need to get authorization from users (usually via an OAuth flow)
in order to access their mail. This means that users shouldn't be
surprised that you're sending mail from their accounts, and they'll
have some control over your access.
The mail will be signed and come from the appropriate IP addresses to
comply with the various spam-control mechanisms set up by those
companies. Without this, it's likely that the mail you send will end
up in the bit-bucket of the recipient.
By using the API, the service should be able to keep a copy of the
sent mail in the user's outgoing mail folder. This will let the user
see and search for the original message sent if they want.
Unfortunately, this may also mean that each mail service you want to send from will need separate integration, and that you may not be able to send as the user's email address from smaller providers.
Note that the App Engine mail API allows you to send mail as the currently logged-in user (when logging in, users have a similar consent screen to the OAuth process mentioned above).

Send email from server without SMTP enabled

I have written a couple of web sites that contain a "contact us" form.
However, our host recently switched SMTP off. Their excuse is "security issues".
The solution they offer is that they implemented rules whereby all mail generated from the platforms must be sent using the sendmail/phpmail functions and pass through a mail relay which checks the mails and their content and ensures malicious content and activity is completely blocked and they recommend I use "A virtual or dedicated solution".
I have no idea what it is they want me to do to get emailing working again and this is quite urgent as many clients are not getting their emails.
Is there an easy way to go around this in order to get emailing working again?
Many thanks in advance
It generally means that you will have to specify the new mail server they are providing instead of localhost in your code. Further, earlier, you were able to send the mail without authenticating but now on, you must have an account and you must authenticate before you send the mail. (I am not sure though, may be they allow relay to their own servers and you might not need authentication).
Go to the control panel of your hosting account and check for the mail panel. Check out the new smtp server name there and code your site to use this smtp server with credentials. This will let you send mail again.

JavaMail to send email out which server?

Here is my issue, I'm creating a website with a little login and resetting password. It's basic stuff, when user forget the password they can click the link and my application will send an email with a link to reset the password. Now, I'm using Google App to send/receive email so I created a new alias like noreply#company.com.
And I just got a confirm email from Google that I'm not allowed to use Google Server to send out email by JavaMail, because they do not support JavaMail as a mail client, the issue that I'm having is I'm getting AuthenticationException back from smtp.google.com.
Moreover, I'm using Amazon EC2 to host the application as well, and amazon provides SES service to send out emails. So, the question would be can I use Google App to host our company email for every employee, but can I still use Amazon SES to send out emails by JavaMail within the same domain name as we are using with Google Apps?. So, the emails that we'll be sending out would be noreply#company.com but will be from Amazon SES.
I'm not sure if I'm making this clear enough, my concern would be we redirect email MX Record to Google App already, I think we cannot redirect to Google and Amazon at the same time?
The application we are writing is based on Grails, so the email would be from Spring Email
Cheers,
Based on my usage of Amazon SES, you should be able to use the configuration you are suggesting without any issues. You do not need to add/change any MX record when using SES, because SES does not allow you to receive emails. It is only a service for sending (relaying) email messages, i.e., as far as I understood your needs, it will serve you perfectly, and your source email address will be the same as you use today.
When you sign up for SES and want to start sending test messages, you need to verify your source and destination email addresses before actually sending emails. You can achieve this verification through either scripting (ses-verify-email-address.pl) or API (VerifyEmailAddress on AWS SDK). After sending the verification request, you should receive an email address on the verified account. Just follow the message instructions and you can safely send some test messages.
When you are satisfied with your testing, you should request production access, and after this step, you no longer need to perform verification on destination e-mail addresses.
In order to call the API, I think you can use the AWS SDK for Java without problems in your application.
See more on:
http://aws.amazon.com/ses/
http://aws.amazon.com/sdkforjava/