├── .classpath ├── .github └── FUNDING.yml ├── .project ├── .settings ├── org.eclipse.core.resources.prefs ├── org.eclipse.jdt.core.prefs └── org.eclipse.m2e.core.prefs ├── LICENSE ├── README.md ├── pom.xml ├── src ├── main │ └── java │ │ └── com │ │ └── ashish │ │ └── Email_Sender_Using_Java │ │ └── App.java └── test │ └── java │ └── com │ └── ashish │ └── Email_Sender_Using_Java │ └── AppTest.java └── target ├── classes └── com │ └── ashish │ └── Email_Sender_Using_Java │ ├── App$1.class │ └── App.class └── test-classes └── com └── ashish └── Email_Sender_Using_Java └── AppTest.class /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: ["https://paypal.me/ashish2030", 13 | "https://www.buymeacoffee.com/ashish2030"] 14 | # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 15 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Email-Sender-Using-Java 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/test/java=UTF-8 4 | encoding/=UTF-8 5 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 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.enablePreviewFeatures=disabled 5 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 6 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore 7 | org.eclipse.jdt.core.compiler.release=disabled 8 | org.eclipse.jdt.core.compiler.source=1.5 9 | -------------------------------------------------------------------------------- /.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Ashish Kumar 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Email_Sender_Without_attachment_using_Java 2 | 3 | 4 | https://user-images.githubusercontent.com/61516051/118387720-a86e6700-b63d-11eb-8f81-2f47911a482a.mp4 5 | 6 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | com.ashish 6 | Email-Sender-Using-Java 7 | 0.0.1-SNAPSHOT 8 | jar 9 | 10 | Email-Sender-Using-Java 11 | http://maven.apache.org 12 | 13 | 14 | UTF-8 15 | 16 | 17 | 18 | 19 | com.sun.mail 20 | javax.mail 21 | 1.6.2 22 | 23 | 24 | junit 25 | junit 26 | 3.8.1 27 | test 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/main/java/com/ashish/Email_Sender_Using_Java/App.java: -------------------------------------------------------------------------------- 1 | package com.ashish.Email_Sender_Using_Java; 2 | import java.util.*; 3 | import javax.mail.Authenticator; 4 | import javax.mail.Message; 5 | import javax.mail.PasswordAuthentication; 6 | import javax.mail.Session; 7 | import javax.mail.Transport; 8 | import javax.mail.internet.InternetAddress; 9 | import javax.mail.internet.MimeMessage; 10 | 11 | public class App 12 | { 13 | 14 | public static void main( String[] args ) 15 | { 16 | System.out.println("preparing to send message ..."); 17 | String message = "Happy Coding "; 18 | String subject = "Checking my Code"; 19 | String to = "rs8657511@gmail.com"; 20 | String from = "Kumarashish79924@gmail.com"; 21 | 22 | sendEmail(message,subject,to,from); 23 | } 24 | private static void sendEmail(String message, String subject, String to, String from) { 25 | 26 | //Variable for gmail 27 | String host="smtp.gmail.com"; 28 | 29 | //get the system properties 30 | Properties properties = System.getProperties(); 31 | System.out.println("PROPERTIES "+properties); 32 | 33 | //setting important information to properties object 34 | 35 | //host set 36 | properties.put("mail.smtp.host", host); 37 | properties.put("mail.smtp.port","465"); 38 | properties.put("mail.smtp.ssl.enable","true"); 39 | properties.put("mail.smtp.auth","true"); 40 | 41 | //Step 1: to get the session object.. 42 | Session session=Session.getInstance(properties, new Authenticator() { 43 | 44 | @Override 45 | protected PasswordAuthentication getPasswordAuthentication() { 46 | // TODO Auto-generated method stub 47 | return new PasswordAuthentication("kumarashish79924@gmail.com","*******"); 48 | } 49 | }); 50 | 51 | session.setDebug(true); 52 | 53 | //Step 2 : compose the message [text,multi media] 54 | MimeMessage m = new MimeMessage(session); 55 | 56 | try { 57 | 58 | //from email 59 | m.setFrom(from); 60 | 61 | //adding recipient to message 62 | m.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); 63 | 64 | //adding subject to message 65 | m.setSubject(subject); 66 | 67 | 68 | //adding text to message 69 | m.setText(message); 70 | 71 | //send 72 | 73 | //Step 3 : send the message using Transport class 74 | Transport.send(m); 75 | 76 | System.out.println("Sent success..................."); 77 | 78 | 79 | }catch (Exception e) { 80 | e.printStackTrace(); 81 | } 82 | 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/test/java/com/ashish/Email_Sender_Using_Java/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.ashish.Email_Sender_Using_Java; 2 | 3 | import junit.framework.Test; 4 | import junit.framework.TestCase; 5 | import junit.framework.TestSuite; 6 | 7 | /** 8 | * Unit test for simple App. 9 | */ 10 | public class AppTest 11 | extends TestCase 12 | { 13 | /** 14 | * Create the test case 15 | * 16 | * @param testName name of the test case 17 | */ 18 | public AppTest( String testName ) 19 | { 20 | super( testName ); 21 | } 22 | 23 | /** 24 | * @return the suite of tests being tested 25 | */ 26 | public static Test suite() 27 | { 28 | return new TestSuite( AppTest.class ); 29 | } 30 | 31 | /** 32 | * Rigourous Test :-) 33 | */ 34 | public void testApp() 35 | { 36 | assertTrue( true ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /target/classes/com/ashish/Email_Sender_Using_Java/App$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashish2030/Email_Sender_Without_attachment_using_Java/fabbbb4b2d58aac78f10b9db44e095d69377155c/target/classes/com/ashish/Email_Sender_Using_Java/App$1.class -------------------------------------------------------------------------------- /target/classes/com/ashish/Email_Sender_Using_Java/App.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashish2030/Email_Sender_Without_attachment_using_Java/fabbbb4b2d58aac78f10b9db44e095d69377155c/target/classes/com/ashish/Email_Sender_Using_Java/App.class -------------------------------------------------------------------------------- /target/test-classes/com/ashish/Email_Sender_Using_Java/AppTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ashish2030/Email_Sender_Without_attachment_using_Java/fabbbb4b2d58aac78f10b9db44e095d69377155c/target/test-classes/com/ashish/Email_Sender_Using_Java/AppTest.class --------------------------------------------------------------------------------