Get E-Mail domain name of official email IDs - java

I am currently writing a program for an E-mail system app. In that app, users can sign in with an email account of any domain. For personal email ids, I am using the following code to get the domain name:
String[] temp = emailId.split("#");
temp = temp[1].split("\\.");
return temp[0];
But this method wouldn't work for official email ids like: name#collegename.edu.in. It is necessary to find email domain names to find appropriate IMAP and SMTP servers for reading and sending mail. How can we find email domains for such email ids.

Related

Cognito email verification not being sent

I'm experimenting with Cognito but I can't seem to figure out how to get Cognito to send a verification email to a user for them to verify their email address.
This is in my back-end server, where I've received the username, email, and password from a new user. I'm suppressing the message action because I don't want users to receive a temporary password. Instead, I want to set the password to what they've already provided me.
AdminCreateUserRequest adminCreateUserRequest = new AdminCreateUserRequest().withUserPoolId("<user pool ID>")
.withUsername(registerUserRequest.getUsername())
.withUserAttributes(new AttributeType().withName("email")
.withValue(registerUserRequest.getEmail()), new AttributeType().withName("email_verified")
.withValue("false"))
.withMessageAction(MessageActionType.SUPPRESS);
awsCognitoIdentityProvider.adminCreateUser(adminCreateUserRequest);
AdminSetUserPasswordRequest adminSetUserPasswordRequest = new AdminSetUserPasswordRequest().withUserPoolId(<user pool ID>)
.withUsername(registerUserRequest.getUsername())
.withPassword(registerUserRequest.getPassword())
.withPermanent(true);
awsCognitoIdentityProvider.adminSetUserPassword(adminSetUserPasswordRequest);
However, users are never receiving an email to verify their email address. In the user pool configuration, I have "Email" selected under "Which attributes do you want to verify?" and I've verified the email address I'm sending from in SES. Am I missing something here?
If you use AdminCreateUser the account will always be created with a temporary password.
What you actually want is Signup.

JavaMail - Mask "from" address

I have a piece of software I am developing that includes user accounts and login/passwords. For password storage/protection, I am using an asymmetric salt+hash system, and thus, if a user forgets their password, I would like the software to send a password reset link to the user's email address.
My question is this: is it possible to send this email from an address that does not actually exist (like do-not-reply#myproject.com)? Alternatively, is there a way to send it from a real email address but to mask the "from" address and make it appear to the recipient as do-not-reply#myproject.com even if it truly came from myemail#gmail.com?
Yes, you can send the e-mail to appear to come from any address. It is important to recognize that there are two 'from' addresses - the envelope sender is often not displayed to the recipient but indicates the server that is sending the message. The 'from' address is different and is specified in the message headers. As this is what what the recipient sees, it sounds like you simply need to customize your 'from' address header in the message.
Note: Some users will have e-mail servers that require proof that your server is authorized to send e-mail from the domain in the 'from' header. You can do this with an SPF record on the mydomain.com DNS zone file.

When making a request as an account that does not have a mailbox, you must specify the mailbox primary SMTP address for any distinguished folder Ids

I am using EWS java api. We Dont have outlook configuration for some group email ids. we are using browser to check emails coming to those ids with credentials. and we use browser URL as
https://outlook.abc.met/owa/Contractsatxxxx.com
Urls are end with email ids.
When I tried to read emails coming to these email ids getting below error.
ERROR:
----------------------------------------- microsoft.exchange.webservices.data.core.exception.service.remote.ServiceResponseException:
The SMTP address has no mailbox associated with it.
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
ExchangeCredentials credentials = new WebCredentials(userName, password);
service.setCredentials(credentials);
service.setUrl(new URI(hostUrl));
Folder rootfolder = Folder.bind(service, WellKnownFolderName.MsgFolderRoot);

Find a JIRA user by e-mail address with JIRA REST API

I'm using JIRA REST API for accessing JIRA from a third party application.
I'm trying to find whether a user account exists in JIRA for a particular e-mail address. The same is working for user name but not for e-mail address.
Could you please let me know how to do it? I have gone through this documentation.
According to the document you linked, the REST call
api/2/groupuserpicker
searches by username OR email address.
parameter type description
------------ ------- --------------------------------------------------------
query string A string used to search username, Name or e-mail address
If it's not working with an email address then you should be submitting a support request to Atlassian.

Is it possible to mask/spoof email address while sending mail in Java

In simple word, whenever I will send mail to anyone (within same mail server) it should appears some fake email address i.e. fakemail#gmail.com but, when they reply to this mail, it should come to my actual email address that is realname#gmail.com.
Note: My both email addresses will use same domain name, but only difference will be fake and real username for that email. I needed for the privacy issue. So, that nobody can reply to my mail directly until I send any mail to them.
Ask your mail server administrator to setup an email forwarding for you.
This is not a Java specific question. What you are asking for is called an
Email alias, and is a standard functionality on mail servers.
You can use a fake "from:" field and a valid "reply-to:" field, but the only people that will be fooled by this are people who would not know how to send spam anyway.
Even if you can (see below) mask the From field, you are giving away your email address in the Reply-To field, so you are still revealing your email address. (And if you weren't, it wouldn't be possible to reply.) So go with #Anony-Mousse and find a proper solution.
Now, please note that there are two "from" fields: one in the SMTP envelope and another in the message data.
It is quite uncommon for current mail servers to let you fake the SMTP from, though it may be possible if the server is using raw SMTP without authorization.
You are more likely to be allowed to send an email with a custom "From" in the message body (which is the one mail clients display, unless you look att all headers). However, the mail server may require that it matches the user you authenticated as.

Categories