Category email

Send email from servlet using java mail

package mailpack; import java.io.IOException;import java.util.Properties; import javax.mail.Message;import javax.mail.MessagingException;import javax.mail.NoSuchProviderException;import javax.mail.PasswordAuthentication;import javax.mail.Session;import javax.mail.Transport;import javax.mail.internet.InternetAddress;import javax.mail.internet.MimeBodyPart;import javax.mail.internet.MimeMessage;import javax.mail.internet.MimeMultipart;import javax.naming.Context;import javax.naming.InitialContext;import javax.naming.NamingException;import javax.servlet.ServletException;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse; public class send extends HttpServlet { private static final long serialVersionUID = 1L; public send() { //…

Send mail from command prompt using powershell

Commands: powershell$EmailFrom = “sendermailID@gmail.com”$EmailTo = “receivermailID1@gmail.com,receivermailID2@gmail.com”$Subject = “The subject of your email”$Body = “This is just a test mail to verify the working of CMD”$SMTPServer = “smtp.gmail.com”$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)$SMTPClient.EnableSsl = $true$SMTPClient.Credentials = New-Object System.Net.NetworkCredential(“sendermailID@gmail.com”, “senderPassword”)$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)pause

Enable Notifications OK No thanks