Get email sender's address domain name

I am trying to extract just the sender’s address domain name from a list of emails to create a specific desktop folder…for example if i get an email from person@company.com I want to create a desktop folder that is named by the “company” part of the email senders address.

1 Like

You can use regex the following regex to get everything between @ and .
(?<=@).*(?=\.)

@UiUser

You can get your domain name like this

In place of “Myname@domain.com” you can mention your string variable (which is your extracted email address)

Thanks,
Aman

For Each Mail Message
You can use “MailMessage.From.Host.toString” to the Company part
Example - “xyz@abc.com” is the sender Email ID
temp = “MailMessage.From.Host.toString” //this will give you “abc.com
foldername = temp.split(“.”)(0) //this will give you just abc