Username: Password:
Subject: Recipient: Message Body:
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@page import="java.util.Properties"%>
<%@page import="javax.mail.Session"%>
<%@page import="javax.mail.Authenticator"%>
<%@page import="javax.mail.PasswordAuthentication"%>
<%@page import="javax.mail.Message"%>
<%@page import="javax.mail.internet.MimeMessage"%>
<%@page import="javax.mail.internet.InternetAddress"%>
<%@page import="javax.mail.Transport"%>
<%
String smtpServer = null;
String smtpPort = null;
final String authAddress = request.getParameter("auth\_add");
final String authPassword = request.getParameter("auth\_pass");
String subject = null;
String email = null;
String message = null;
String send = request.getParameter("send");
String siteName=request.getServerName();
siteName=siteName.replaceAll("www.","");
if(send!=null){
smtpServer = request.getParameter("smtp\_server");
smtpPort = request.getParameter("smtp\_port");
subject = request.getParameter("subject");
email = request.getParameter("email");
message = request.getParameter("message");
try{
Properties props = new Properties();
props.put("mail.smtp.host", smtpServer);
props.put("mail.smtp.port", smtpPort);
props.put("mail.smtp.auth", "true");
// create some properties and get the default Session
Session sessionMail = Session.getInstance(props, new Authenticator() {
public PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(authAddress, authPassword);
}
});
sessionMail.setDebug(true);
// create a message
Message msg = new MimeMessage(sessionMail);
// set the from and to address
InternetAddress addressFrom = new InternetAddress(authAddress);
msg.setFrom(addressFrom);
InternetAddress\[] addressTo = new InternetAddress[1];
addressTo[0] = new InternetAddress(email);
msg.setRecipients(Message.RecipientType.TO, addressTo);
// Optional : You can also set your custom headers in the Email if you Want
msg.addHeader("site", siteName);
// Setting the Subject and Content Type
msg.setSubject(subject);
msg.setContent(message, "text/plain");
Transport.send(msg);
}catch(Exception e){
e.printStackTrace(response.getWriter());
}
}
%>
Was this page helpful?
