Skip to content

AdharshMMsft/ACS_Email_Java_Implementation_Windows

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 

Repository files navigation

ACS_Email_Java_Implementation_Windows

Implementation of Email with ACS in Java

Java JDK installation process

  1. Go to the Adoptium JDK website and download JDK 8 msi installer for Windows.

image

  1. Install the JDK with the configuration shown in the below image.

image

  1. Now open a new window of Command Prompt and run the command "java -version" and followed by "javac -version". If there are no errors in the output, and the version number is being shown in the output, then Java installation is successful.

image

Maven Installation Process

  1. Go to the Apache Maven website and download the Binary Zip Archive of Apache Maven.

image

  1. Extract the compressed folder and copy the path upto the "bin" folder.

image

  1. Now go to "Start" and search for "Edit the environment variables" and click on "Environment Variables".

image

  1. Now, under "System variables", click on "Path" followed by "Edit". Now, click "New", and paste the path that was copied. Click "Ok" and close.

image

  1. Now open a new window of Command Prompt and run the command "mvn --version". If there are no errors in the output, and the version number is being shown in the output, then Maven installation is successful.

image

Creating Azure Communication Service Resource.

  1. Go to Azure Portal and search for "Communication Services" and select it.

image

  1. Click on "Create", select the "Subscription", "Resource Group", "Resource Name" and the "Data Location", then click "Review + Create".

image

  1. After creating, go to the resource and then go to "Keys" under "Settings" and keep note of the "Endpoint", "Connection string", and "Key".

image

image

Creating Email Communication Services

  1. Go to Azure Portal and search for "Email Communication Services" and select it.

image

  1. Click on "Create", select the "Subscription", "Resource Group", "Resource Name", "Region" and the "Data Location", then click "Review + Create".

image

  1. After creating, go to the resource and then go to "Provision Domains" under "Settings".

image

  1. Click on "Add domain" and choose the domain setup according to preference.

image

  1. Now go back to the Communication Service that was created. Under "Email", click on "Domains".

image

  1. Now click on "Connect Domain", and select the domain which was set on the Email Communication Service.

image

Creating a Java Project

  1. Go to the Command Prompt, and type the following Maven command: mvn archetype:generate "-DgroupId=com.projectname" "-DartifactId=projectname" "-DarchetypeArtifactId=maven-archetype-quickstart" "-DarchetypeVersion=1.4" "-DinteractiveMode=false" and press enter.

image

  1. Now open the maven project you have created on the IDE, and open the file "pom.xml" in it. Now copy the contents of "pom.xml" in the repository to that in the project folder.

  2. Now open the java file (in "src\main\java\com\yourprojectname\yourprojectname\App.java") and copy the contents of the java file in the repository to the java file in the project.

WARNING: Before proceeding further, make sure the values for connection string, key, sender email, receiver email, subject and content. Without them it would lead to build errors.

Building and running the project.

  1. Run the below commands on the terminal (command prompt / powershell in windows) (make sure the terminal path is your project's path).

mvn compile && mvn package && mvn exec:java -Dexec.mainClass="com.communication.quickstart.App" -Dexec.cleanupDaemonThreads=false

NOTE:- // Make sure you change the package name in "-Dexec.mainClass = "change name here.App".

About

Implementation of Email with ACS in Java

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages