

{"id":81355,"date":"2020-09-01T09:00:24","date_gmt":"2020-09-01T03:30:24","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=81355"},"modified":"2021-08-25T13:47:25","modified_gmt":"2021-08-25T08:17:25","slug":"jsp-sending-email","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/jsp-sending-email\/","title":{"rendered":"JSP Sending Email"},"content":{"rendered":"<p>In this article, we will discuss how to send emails using JSP. Along with it, we will see attachment Email, HTML Email, forms for Email, and authentication for Email using JSP. So let&#8217;s start JSP Sending Email tutorial.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Email-sending.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-81457\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Email-sending.jpg\" alt=\"JSP Email sending\" width=\"1200\" height=\"628\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Email-sending.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Email-sending-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Email-sending-1024x536.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Email-sending-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Email-sending-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Email-sending-520x272.jpg 520w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><\/p>\n<p>Sending emails through the client&#8217;s machine is an important functionality provided by JSP.<\/p>\n<p><strong>JavaMail API<\/strong> and the <strong>Java Activation Framework (JAF)<\/strong> should be installed on the machine to send emails using JSP. Download these files and unzip them in newly formed directories. Amongst many jar files, add mail.jar and activation.jar file to the Classpath.<\/p>\n<p><strong>Flow of Creating Email in JSP<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/Flow-of-Creating-Email-in-JSP.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-81458\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/Flow-of-Creating-Email-in-JSP.jpg\" alt=\"Flow of Creating Email in JSP\" width=\"524\" height=\"296\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/Flow-of-Creating-Email-in-JSP.jpg 524w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/Flow-of-Creating-Email-in-JSP-300x169.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/Flow-of-Creating-Email-in-JSP-150x85.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/Flow-of-Creating-Email-in-JSP-520x294.jpg 520w\" sizes=\"auto, (max-width: 524px) 100vw, 524px\" \/><\/a><\/p>\n<p>Here the result is determined by result.jsp whereas the mail goes over different steps and using Simple Mail Transfer Protocol, it reaches the recipient.<\/p>\n<p>Sender fills out the mail form and sends it over the sending servlet. While result.jsp checks if the mail is sent successfully or not, it notifies the sender accordingly.<\/p>\n<p><strong>Java mails are sent over certain protocols. They are:<\/strong><\/p>\n<ol>\n<li>SMTP Protocol: It is the most common protocol, better known as Simple Mail Transfer Protocol. This protocol is used to send mails over Internet Protocol. It supports later two protocols while sending messages between servers.<\/li>\n<li>POP Protocol: It is Post Office Protocol used to get mails at remote servers. POP2 sends mail over SMTP protocol, whereas POP3 can send email with or without SMTP.<\/li>\n<li>IMAP Protocol: As the name suggests Internet Message access protocol, it accesses the emails at remote servers as former protocol.<\/li>\n<\/ol>\n<h3>Steps to Create and Send Email<\/h3>\n<p><strong>1. Get the Session Object:<\/strong> Java Mail Session object will do the work as follows:<br \/>\n<strong>For Example:<\/strong> \/\/ Get the Session object.<br \/>\nSession mailSession = Session.getDefaultInstance(properties)<\/p>\n<p><strong>2. Compose the message:<\/strong> This part consists of the main body. Create a Mime message object for the session. Methods like setSubject () and setText () will set the contents.<\/p>\n<p><strong>For Example:<\/strong> MimeMessage msg = new MimeMessage(mailSession)<br \/>\nmessage.setText(&#8220;This is actual message&#8221;)<\/p>\n<p><strong>3. Send the message:<\/strong> Java Mail API uses the method send () of Transport class to send email.<\/p>\n<p><strong>For Example:<\/strong> Transport.send(message);<br \/>\nresult = &#8220;Sent message successfully&#8230;.&#8221;<\/p>\n<h3>Send a Simple Email<\/h3>\n<p>Connect the localhost to the Internet and make sure that jar files from the Java Email API package and the JAF package are available in CLASSPATH. Following is the code:<\/p>\n<p><strong>For Example<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">SendEmail.jsp\r\n&lt;%@ page import = \"java.io.*,java.util.*,javax.mail.*\"%&gt;\r\n&lt;%@ page import = \"javax.mail.internet.*,javax.activation.*\"%&gt;\r\n&lt;%@ page import = \"javax.servlet.http.*,javax.servlet.*\" %&gt;\r\n \r\n&lt;%\r\n   String result;\r\n  \r\n   \/\/ Recipient's email ID needs to be mentioned.\r\n   String to = \"pqr@gmail.com\";\r\n \r\n   \/\/ Sender's email ID needs to be mentioned\r\n   String from = \"xyz@gmail.com\";\r\n \r\n   \/\/ Assuming email sent from localhost\r\n   String host = \"localhost\";\r\n \r\n   \/\/ Get properties object\r\n   Properties properties = System.getProperties();\r\n \r\n   \/\/ Setup mail server\r\n   properties.setProperty(\"mail.smtp.host\", host);\r\n \r\n   \/\/ Get the Session object.\r\n   Session mailSession = Session.getDefaultInstance(properties);\r\n \r\n   try {\r\n  \t\/\/ Create a MimeMessage object.\r\n  \tMimeMessage msg = new MimeMessage(mailSession);\r\n  \t\r\n  \t\/\/ Set From: header field\r\n  \tmessage.setFrom(new InternetAddress(from));\r\n  \t\r\n  \t\/\/ Set To: header field\r\n      message.addRecipient(Message.RecipientType.TO,\r\n                           \tnew InternetAddress(to));\r\n  \t\/\/ Set Subject:\r\n \tmessage.setSubject(\"This is the Subject Line!\");\r\n  \t\r\n  \t\/\/ Set the actual message\r\n  \tmessage.setText(\"This is actual message\");\r\n  \t\r\n  \t\/\/ Send message\r\n  \tTransport.send(message);\r\n  \tresult = \"Sent message successfully.\";\r\n   } catch (MessagingException mex) {\r\n  \tmex.printStackTrace();\r\n  \tresult = \"Error: could not send message....\";\r\n   }\r\n%&gt;\r\n \r\n&lt;html&gt;\r\n   &lt;head&gt;\r\n  \t&lt;title&gt;Send Email using JSP&lt;\/title&gt;\r\n   &lt;\/head&gt;\r\n  \r\n   &lt;body&gt;\r\n     \t&lt;h1&gt;Send Email using JSP&lt;\/h1&gt;\r\n       \t\r\n  \t\r\n     \t&lt;%\r\n        \tout.println(\"Result: \" + result + \"\\n\");\r\n     \t%&gt;\r\n \t\r\n   &lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>Call this program through http:\/\/localhost:8080\/SendEmail.jsp. This will help send an email to the given email ID pqr@gmail.com. You will receive the following response \u2013<\/p>\n<p><strong>Output:<\/strong><\/p>\n<p>()<\/p>\n<p>To send email to multiple ids, use the following code:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">void addRecipients(Message.RecipientType type, Address[] addresses)\r\n<\/pre>\n<p>Description of the parameters used above are \u2212<\/p>\n<ul>\n<li><strong>type \u2013<\/strong> Type can be as follows &#8211; TO, CC, or BCC, where CC is Carbon Copy, and BCC stands for Black Carbon Copy. E.g., Message.RecipientType.TO, Message.RecipientType.CC<\/li>\n<li><strong>addresses \u2013<\/strong> Address here will be InternetAddress() method while specifying email IDs. This will be an array of mail ids that will receive the message.<\/li>\n<\/ul>\n<h3>Send an HTML Email<\/h3>\n<p>Connect the localhost to the Internet and make sure that jar files from the Java Email API package and the JAF package are available in CLASSPATH.<\/p>\n<p>The difference between the former and latter is that in the following code, we will use setContent() method with a second parameter as text\/html to mention that HTML content is there in the message.<\/p>\n<p><strong>For Example<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;%@ page import = \"java.io.*, java.util.*, javax.mail.*\"%&gt;\r\n&lt;%@ page import = \"javax.mail.internet.*, javax.activation.*\"%&gt;\r\n&lt;%@ page import = \"javax.servlet.http.*, javax.servlet.*\" %&gt;\r\n \r\n&lt;%\r\n   String result;\r\n  \r\n   \/\/ Recipient's email ID needs to be mentioned.\r\n   String to = \"abcd@gmail.com\";\r\n \r\n   \/\/ Sender's email ID needs to be mentioned\r\n   String from = \"mcmohd@gmail.com\";\r\n \r\n   \/\/ Assuming email sent from localhost\r\n   String host = \"localhost\";\r\n \r\n   \/\/ Get properties object\r\n   Properties properties = System.getProperties();\r\n \r\n   \/\/ Setup mail server\r\n   properties.setProperty(\"mail.smtp.host\", host);\r\n \r\n   \/\/ Get Session object.\r\n   Session mailSession = Session.getDefaultInstance(properties);\r\n \r\n   try {\r\n  \t\/\/ Create a MimeMessage object.\r\n  \tMimeMessage message = new MimeMessage(mailSession);\r\n  \t\r\n  \t\/\/ Set From: header field\r\n  \tmessage.setFrom(new InternetAddress(from));\r\n  \t\r\n  \t\/\/ Set To: header field\r\n      message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));\r\n  \t\r\n  \t\/\/ Set Subject: header field\r\n  \tmessage.setSubject(\"Enter Subject Line!\");\r\n \t\r\n  \t\/\/ Send the HTML message\r\n  \tmessage.setContent(\"&lt;h1&gt;This is actual message&lt;\/h1&gt;\", \"text\/html\" );\r\n  \t\r\n  \t\/\/ Send message\r\n  \tTransport.send(message);\r\n  \tresult = \"Sent message successfully....\";\r\n   } catch (MessagingException mex) {\r\n  \tmex.printStackTrace();\r\n  \tresult = \"Error: unable to send message....\";\r\n   }\r\n%&gt;\r\n \r\n&lt;html&gt;\r\n   &lt;head&gt;\r\n  \t&lt;title&gt;Send HTML Email using JSP&lt;\/title&gt;\r\n   &lt;\/head&gt;\r\n \r\n   &lt;body&gt;\r\n \r\n     \t&lt;h1&gt;Send Email using JSP&lt;\/h1&gt;\r\n  \t\r\n           \t&lt;%\r\n        \tout.println(\"Result: \" + result + \"\\n\");\r\n     \t%&gt;\r\n     \t&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>Above JSP code will send an HTML message on a given email ID.<\/p>\n<h3>Send Attachment in Email<\/h3>\n<p>Send an email with attachment using following code \u2212<\/p>\n<p><strong>For Example<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;%@ page import = \"java.io.*, java.util.*, javax.mail.*\"%&gt;\r\n&lt;%@ page import = \"javax.mail.internet.*, javax.activation.*\"%&gt;\r\n&lt;%@ page import = \"javax.servlet.http.*, javax.servlet.*\" %&gt;\r\n \r\n&lt;%\r\n   String result;\r\n  \r\n   \/\/ Recipient's email ID\r\n   String to = \"abcd@gmail.com\";\r\n \r\n   \/\/ Sender's email ID\r\n   String from = \"mcmohd@gmail.com\";\r\n \r\n   \/\/ Assuming email is sent from localhost\r\n   String host = \"localhost\";\r\n \r\n   \/\/ Get properties object\r\n   Properties properties = System.getProperties();\r\n \r\n   \/\/ Setup mail server\r\n   properties.setProperty(\"mail.smtp.host\", host);\r\n \r\n   \/\/ Get Session object.\r\n   Session mailSession = Session.getDefaultInstance(properties);\r\n \r\n   try {\r\n  \t\/\/ Create a MimeMessage object.\r\n  \tMimeMessage message = new MimeMessage(mailSession);\r\n \r\n  \t\/\/ Set From: header field\r\n  \tmessage.setFrom(new InternetAddress(from));\r\n \r\n  \t\/\/ Set To: header field\r\n      message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));\r\n \r\n  \t\/\/ Set Subject:\r\n  \tmessage.setSubject(\"This is the Subject Line!\");\r\n \r\n  \t\/\/ Create the message section\r\n  \tBodyPart messageBodyPart = new MimeBodyPart();\r\n \r\n  \t\/\/ Fill the message\r\n  \tmessageBodyPart.setText(\"This is message body\");\r\n  \t\r\n  \t\/\/ Create a multipart message\r\n  \tMultipart multipart = new MimeMultipart();\r\n \r\n  \t\/\/ Set text message part\r\n  \tmultipart.addBodyPart(messageBodyPart);\r\n \r\n  \t\/\/ Second is attachment\r\n  \tmessageBodyPart = new MimeBodyPart();\r\n  \t\r\n  \tString filename = \"file.txt\";\r\n  \tDataSource source = new FileDataSource(filename);\r\n  \tmessageBodyPart.setDataHandler(new DataHandler(source));\r\n  \tmessageBodyPart.setFileName(filename);\r\n  \tmultipart.addBodyPart(messageBodyPart);\r\n \r\n  \t\/\/ Send complete message\r\n  \tmessage.setContent(multipart );\r\n \r\n  \t\/\/ Send message\r\n  \tTransport.send(message);\r\n  \tString title = \"Send Email\";\r\n  \tresult = \"Sent message successfully....\";\r\n   } catch (MessagingException mex) {\r\n  \tmex.printStackTrace();\r\n  \tresult = \"Error: unable to send message....\";\r\n   }\r\n%&gt;\r\n \r\n&lt;html&gt;\r\n   &lt;head&gt;\r\n      &lt;title&gt;Send Attachment Email&lt;\/title&gt;\r\n   &lt;\/head&gt;\r\n  \r\n   &lt;body&gt;\r\n  \t\r\n         &lt;h1&gt;Send Attachment Email&lt;\/h1&gt;\r\n\r\n     \t&lt;%out.println(\"Result: \" + result + \"\\n\");%&gt;\r\n   &lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>The above code will help to send an attachment email using JSP.<\/p>\n<h3>User Authentication<\/h3>\n<p>For authentication, we need an ID and password for user authentication purposes which can be set using the following properties:<\/p>\n<ul>\n<li>props.setProperty(&#8220;mail.user&#8221;, &#8220;my_user&#8221;);<\/li>\n<li>props.setProperty(&#8220;mail.password&#8221;, &#8220;my_pwd&#8221;);<\/li>\n<\/ul>\n<p>These can be added to the above code to set user authentication.<\/p>\n<h3>Forms to Send Email<\/h3>\n<p>HTML forms can be used to accept email parameters. Use the request object to get all the information as follows &#8211;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">String to = request.getParameter(\"to\");\r\nString from = request.getParameter(\"from\");\r\nString subject = request.getParameter(\"subject\");\r\nString messageText = request.getParameter(\"body\");\r\n<\/pre>\n<p>Use the above-explained code after these steps.<\/p>\n<h2>Conclusion<\/h2>\n<p>In reference to the above article, we learnt the sending mechanism of Email using JSP. It consists of different parts like using forms, setting user authentication, HTML emails, attachment emails etc.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we will discuss how to send emails using JSP. Along with it, we will see attachment Email, HTML Email, forms for Email, and authentication for Email using JSP. So let&#8217;s start&#46;&#46;&#46;<\/p>\n","protected":false},"author":10,"featured_media":81457,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22403],"tags":[23105,23106],"class_list":["post-81355","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jsp","tag-jsp-sending-email","tag-sending-email-with-jsp"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>JSP Sending Email - DataFlair<\/title>\n<meta name=\"description\" content=\"Learn step by step process of Creating and sending Email in JSP. Also learn to Send Attachment in Email and user authentication.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/jsp-sending-email\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JSP Sending Email - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Learn step by step process of Creating and sending Email in JSP. Also learn to Send Attachment in Email and user authentication.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/jsp-sending-email\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-09-01T03:30:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-25T08:17:25+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Email-sending.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JSP Sending Email - DataFlair","description":"Learn step by step process of Creating and sending Email in JSP. Also learn to Send Attachment in Email and user authentication.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/jsp-sending-email\/","og_locale":"en_US","og_type":"article","og_title":"JSP Sending Email - DataFlair","og_description":"Learn step by step process of Creating and sending Email in JSP. Also learn to Send Attachment in Email and user authentication.","og_url":"https:\/\/data-flair.training\/blogs\/jsp-sending-email\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2020-09-01T03:30:24+00:00","article_modified_time":"2021-08-25T08:17:25+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Email-sending.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/jsp-sending-email\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/jsp-sending-email\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/a90b082e16aa38d207212d22b0581f33"},"headline":"JSP Sending Email","datePublished":"2020-09-01T03:30:24+00:00","dateModified":"2021-08-25T08:17:25+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/jsp-sending-email\/"},"wordCount":702,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/jsp-sending-email\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Email-sending.jpg","keywords":["JSP sending email","sending email with jsp"],"articleSection":["JSP Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/jsp-sending-email\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/jsp-sending-email\/","url":"https:\/\/data-flair.training\/blogs\/jsp-sending-email\/","name":"JSP Sending Email - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/jsp-sending-email\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/jsp-sending-email\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Email-sending.jpg","datePublished":"2020-09-01T03:30:24+00:00","dateModified":"2021-08-25T08:17:25+00:00","description":"Learn step by step process of Creating and sending Email in JSP. Also learn to Send Attachment in Email and user authentication.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/jsp-sending-email\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/jsp-sending-email\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/jsp-sending-email\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Email-sending.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/08\/JSP-Email-sending.jpg","width":1200,"height":628,"caption":"JSP Email sending"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/jsp-sending-email\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"JSP Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/jsp\/"},{"@type":"ListItem","position":3,"name":"JSP Sending Email"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/a90b082e16aa38d207212d22b0581f33","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/dd6de0d647a0185cd6faf264e4ba860b0d85d08d7070766f9cd41bea5bb0b227?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/dd6de0d647a0185cd6faf264e4ba860b0d85d08d7070766f9cd41bea5bb0b227?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/dd6de0d647a0185cd6faf264e4ba860b0d85d08d7070766f9cd41bea5bb0b227?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team is passionate about delivering top-notch tutorials and resources on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. With expertise in the tech industry, we simplify complex topics to help learners excel. Stay updated with our latest insights.","url":"https:\/\/data-flair.training\/blogs\/author\/dfadteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/81355","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=81355"}],"version-history":[{"count":2,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/81355\/revisions"}],"predecessor-version":[{"id":81459,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/81355\/revisions\/81459"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/81457"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=81355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=81355"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=81355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}