Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cb5ebbc

Browse filesBrowse files
committed
1
1 parent df31a71 commit cb5ebbc
Copy full SHA for cb5ebbc

File tree

Expand file treeCollapse file tree

60 files changed

+982
-0
lines changed
Open diff view settings
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

60 files changed

+982
-0
lines changed
Open diff view settings
Collapse file
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Mar 25, 2019 10:07:46 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
2+
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@204f30ec: startup date [Mon Mar 25 10:07:46 IST 2019]; root of context hierarchy
3+
Mar 25, 2019 10:07:47 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
4+
INFO: Loading XML bean definitions from class path resource [applicationContext.xml]
5+
Email sent successfully
Collapse file
+32Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" output="target/classes" path="src/main/java">
4+
<attributes>
5+
<attribute name="optional" value="true"/>
6+
<attribute name="maven.pomderived" value="true"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
10+
<attributes>
11+
<attribute name="maven.pomderived" value="true"/>
12+
</attributes>
13+
</classpathentry>
14+
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
15+
<attributes>
16+
<attribute name="optional" value="true"/>
17+
<attribute name="maven.pomderived" value="true"/>
18+
<attribute name="test" value="true"/>
19+
</attributes>
20+
</classpathentry>
21+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
22+
<attributes>
23+
<attribute name="maven.pomderived" value="true"/>
24+
</attributes>
25+
</classpathentry>
26+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
27+
<attributes>
28+
<attribute name="maven.pomderived" value="true"/>
29+
</attributes>
30+
</classpathentry>
31+
<classpathentry kind="output" path="target/classes"/>
32+
</classpath>
Collapse file
+23Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>SpringDemo</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.m2e.core.maven2Builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.jdt.core.javanature</nature>
21+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
22+
</natures>
23+
</projectDescription>
Collapse file
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
3+
org.eclipse.jdt.core.compiler.compliance=1.5
4+
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
5+
org.eclipse.jdt.core.compiler.release=disabled
6+
org.eclipse.jdt.core.compiler.source=1.5
Collapse file
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
activeProfiles=
2+
eclipse.preferences.version=1
3+
resolveWorkspaceProjects=true
4+
version=1
Collapse file
+49Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>com.ram.core</groupId>
6+
<artifactId>SpringDemo</artifactId>
7+
<packaging>jar</packaging>
8+
<version>1.0-SNAPSHOT</version>
9+
<name>SpringDemo</name>
10+
<url>http://maven.apache.org</url>
11+
12+
<properties>
13+
<spring.version>5.0.9.RELEASE</spring.version>
14+
</properties>
15+
16+
<dependencies>
17+
<dependency>
18+
<groupId>junit</groupId>
19+
<artifactId>junit</artifactId>
20+
<version>3.8.1</version>
21+
<scope>test</scope>
22+
</dependency>
23+
24+
<!-- Java Mail API -->
25+
<dependency>
26+
<groupId>javax.mail</groupId>
27+
<artifactId>mail</artifactId>
28+
<version>1.4.7</version>
29+
</dependency>
30+
31+
32+
<!-- Spring 5 dependencies -->
33+
<dependency>
34+
<groupId>org.springframework</groupId>
35+
<artifactId>spring-core</artifactId>
36+
<version>${spring.version}</version>
37+
</dependency>
38+
39+
40+
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context-support -->
41+
<dependency>
42+
<groupId>org.springframework</groupId>
43+
<artifactId>spring-context-support</artifactId>
44+
<version>${spring.version}</version>
45+
</dependency>
46+
47+
</dependencies>
48+
49+
</project>
Collapse file
+26Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.ram.core;
2+
3+
import org.springframework.context.ApplicationContext;
4+
import org.springframework.context.support.ClassPathXmlApplicationContext;
5+
6+
import com.ram.mail.Email;
7+
8+
public class App
9+
{
10+
public static void main(String[] args)
11+
{
12+
ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
13+
14+
Email email = (Email) context.getBean("email");
15+
16+
String senderEmailId = "testram4321@gmail.com";
17+
String receiverEmailId = "testram4321@gmail.com";
18+
String subject = "Leave Letter";
19+
String message = "I am not feeling well, I am taking sick leave";
20+
21+
email.sendEmail(senderEmailId, receiverEmailId, subject, message);
22+
23+
System.out.println("Email sent successfully");
24+
25+
}
26+
}
Collapse file
+26Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.ram.mail;
2+
3+
import org.springframework.mail.MailSender;
4+
import org.springframework.mail.SimpleMailMessage;
5+
6+
public class Email
7+
{
8+
private MailSender mailSender;
9+
10+
public void setMailSender(MailSender mailSender)
11+
{
12+
this.mailSender = mailSender;
13+
}
14+
15+
public void sendEmail(String from, String to, String subject, String message)
16+
{
17+
18+
SimpleMailMessage simpleMailMessage = new SimpleMailMessage();
19+
20+
simpleMailMessage.setFrom(from);
21+
simpleMailMessage.setTo(to);
22+
simpleMailMessage.setSubject(subject);
23+
simpleMailMessage.setText(message);
24+
mailSender.send(simpleMailMessage);
25+
}
26+
}
Collapse file
+26Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<beans xmlns="http://www.springframework.org/schema/beans"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://www.springframework.org/schema/beans
4+
http://www.springframework.org/schema/beans/spring-beans-4.3.xsd">
5+
6+
<bean id="mailSender"
7+
class="org.springframework.mail.javamail.JavaMailSenderImpl">
8+
<property name="host" value="smtp.gmail.com" />
9+
<property name="username" value="your gmail id" />
10+
<property name="password" value="your gmail password" />
11+
12+
<property name="javaMailProperties">
13+
<props>
14+
<prop key="mail.smtp.auth">true</prop>
15+
<prop key="mail.smtp.socketFactory.port">465</prop>
16+
<prop key="mail.smtp.socketFactory.class">javax.net.ssl.SSLSocketFactory</prop>
17+
<prop key="mail.smtp.port">465</prop>
18+
</props>
19+
</property>
20+
</bean>
21+
22+
<bean id="email" class="com.ram.mail.Email">
23+
<property name="mailSender" ref="mailSender" />
24+
</bean>
25+
26+
</beans>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.