public abstract class EmailProvider {
- public abstract void sendmail(String to, String subject, String message, String from, String replyto, String toname, String fromname, String errorsto, boolean extra) throws IOException;
+ public abstract void sendMail(String to, String subject, String message, String from, String replyto, String toname, String fromname, String errorsto, boolean extra) throws IOException;
private static EmailProvider instance;
BufferedReader br = br0;
PrintWriter pw = pw0;
String line;
- if ( !Sendmail.readSMTPResponse(br, 220)) {
+ if ( !SendMail.readSMTPResponse(br, 220)) {
continue;
}
if (starttls) {
pw.print("STARTTLS\r\n");
pw.flush();
- if ( !Sendmail.readSMTPResponse(br, 220)) {
+ if ( !SendMail.readSMTPResponse(br, 220)) {
continue;
}
Socket s1 = ((SSLSocketFactory) SSLSocketFactory.getDefault()).createSocket(s, host, 25, true);
pw = new PrintWriter(new OutputStreamWriter(s1.getOutputStream(), "UTF-8"));
pw.print("EHLO www.cacert.org\r\n");
pw.flush();
- if ( !Sendmail.readSMTPResponse(br, 250)) {
+ if ( !SendMail.readSMTPResponse(br, 250)) {
continue;
}
}
pw.print("MAIL FROM: <returns@cacert.org>\r\n");
pw.flush();
- if ( !Sendmail.readSMTPResponse(br, 250)) {
+ if ( !SendMail.readSMTPResponse(br, 250)) {
continue;
}
pw.print("RCPT TO: <" + address + ">\r\n");
pw.flush();
- if ( !Sendmail.readSMTPResponse(br, 250)) {
+ if ( !SendMail.readSMTPResponse(br, 250)) {
continue;
}
pw.print("QUIT\r\n");
pw.flush();
- if ( !Sendmail.readSMTPResponse(br, 221)) {
+ if ( !SendMail.readSMTPResponse(br, 221)) {
continue;
}
body.append(l.getTranslation("Best regards"));
body.append("\n");
body.append(l.getTranslation("SomeCA.org Support!"));
- EmailProvider.getInstance().sendmail(address, "[SomeCA.org] " + l.getTranslation("Mail Probe"), body.toString(), "support@cacert.org", null, null, null, null, false);
+ EmailProvider.getInstance().sendMail(address, "[SomeCA.org] " + l.getTranslation("Mail Probe"), body.toString(), "support@cacert.org", null, null, null, null, false);
}
}
import org.cacert.gigi.util.PEM;
import org.cacert.gigi.util.ServerConstants;
-public class Sendmail extends EmailProvider {
+public class SendMail extends EmailProvider {
private final String targetHost;
private final int targetPort;
- protected Sendmail(Properties props) {
+ protected SendMail(Properties props) {
targetHost = props.getProperty("emailProvider.smtpHost", "localhost");
targetPort = Integer.parseInt(props.getProperty("emailProvider.smtpPort", "25"));
}
private static final Pattern NON_ASCII = Pattern.compile("[^a-zA-Z0-9 .-\\[\\]!_@]");
@Override
- public void sendmail(String to, String subject, String message, String from, String replyto, String toname, String fromname, String errorsto, boolean extra) throws IOException {
+ public void sendMail(String to, String subject, String message, String from, String replyto, String toname, String fromname, String errorsto, boolean extra) throws IOException {
String[] bits = from.split(",");
import org.cacert.gigi.GigiApiException;
import org.cacert.gigi.database.GigiPreparedStatement;
import org.cacert.gigi.dbObjects.User;
-import org.cacert.gigi.email.Sendmail;
+import org.cacert.gigi.email.SendMail;
import org.cacert.gigi.localisation.Language;
import org.cacert.gigi.output.template.Form;
import org.cacert.gigi.output.template.SprintfCommand;
outMail.print("\n");
outMail.print(l.getTranslation("SomeCA.org Support!"));
outMail.close();
- Sendmail.getInstance().sendmail(Page.getUser(req).getEmail(), "[SomeCA.org] " + subject, sw.toString(), "support@cacert.org", null, null, null, null, false);
+ SendMail.getInstance().sendMail(Page.getUser(req).getEmail(), "[SomeCA.org] " + subject, sw.toString(), "support@cacert.org", null, null, null, null, false);
out.println(Page.getLanguage(req).getTranslation("Password reset successful."));
} catch (IOException e) {
e.printStackTrace();
@BeforeClass
public static void initMailsystem() throws NoSuchAlgorithmException, KeyManagementException {
Properties prop = new Properties();
- prop.setProperty("emailProvider", "org.cacert.gigi.email.Sendmail");
+ prop.setProperty("emailProvider", "org.cacert.gigi.email.SendMail");
EmailProvider.initSystem(prop, null, null);
SSLContext c = SSLContext.getInstance("TLS");
c.init(null, new TrustManager[] {
String subj = "subj-" + createUniqueName();
String msg = "msg-" + createUniqueName();
- EmailProvider.getInstance().sendmail(succmail, subj, msg, "system@cacert.org", "system@cacert.org", "Testtarget", "Testsender", null, false);
+ EmailProvider.getInstance().sendMail(succmail, subj, msg, "system@cacert.org", "system@cacert.org", "Testtarget", "Testsender", null, false);
try (Socket s = SSLSocketFactory.getDefault().createSocket(imap, 993);//
PrintWriter pw = new PrintWriter(new OutputStreamWriter(s.getOutputStream(), "UTF-8"), true);//
private void initSelfsign() throws GeneralSecurityException, CertificateException, IOException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException {
assumeNotNull(getTestProps().getProperty("emailProvider.smtpHost"), getTestProps().getProperty("emailProvider.smtpPort"));
Properties prop = new Properties();
- prop.setProperty("emailProvider", "org.cacert.gigi.email.Sendmail");
+ prop.setProperty("emailProvider", "org.cacert.gigi.email.SendMail");
prop.setProperty("emailProvider.smtpHost", getTestProps().getProperty("emailProvider.smtpHost"));
prop.setProperty("emailProvider.smtpPort", getTestProps().getProperty("emailProvider.smtpPort"));
KeyPair kp = generateKeypair();
}
@Override
- public void sendmail(String to, String subject, String message, String from, String replyto, String toname, String fromname, String errorsto, boolean extra) throws IOException {
+ public void sendMail(String to, String subject, String message, String from, String replyto, String toname, String fromname, String errorsto, boolean extra) throws IOException {
TestMail tm = new TestEmailReceiver.TestMail(to, subject, message, fromname, replyto) {
@Override
}
@Override
- public void sendmail(String to, String subject, String message, String from, String replyto, String toname, String fromname, String errorsto, boolean extra) throws IOException {
+ public void sendMail(String to, String subject, String message, String from, String replyto, String toname, String fromname, String errorsto, boolean extra) throws IOException {
mails.add(new TestMail(to, subject, message, from, replyto));
}
public CommandlineEmailProvider(Properties p) {}
@Override
- public void sendmail(String to, String subject, String message, String from, String replyto, String toname, String fromname, String errorsto, boolean extra) throws IOException {
+ public void sendMail(String to, String subject, String message, String from, String replyto, String toname, String fromname, String errorsto, boolean extra) throws IOException {
synchronized (System.out) {
System.out.println("== MAIL ==");
System.out.println("To: " + to);
}
@Override
- public synchronized void sendmail(String to, String subject, String message, String from, String replyto, String toname, String fromname, String errorsto, boolean extra) throws IOException {
+ public synchronized void sendMail(String to, String subject, String message, String from, String replyto, String toname, String fromname, String errorsto, boolean extra) throws IOException {
while (true) {
if ( !assureLocalConnection() && target != null) {
- target.sendmail(to, subject, message, from, replyto, toname, fromname, errorsto, extra);
+ target.sendMail(to, subject, message, from, replyto, toname, fromname, errorsto, extra);
return;
}
try {
}
@Override
- public synchronized void sendmail(String to, String subject, String message, String from, String replyto, String toname, String fromname, String errorsto, boolean extra) throws IOException {
+ public synchronized void sendMail(String to, String subject, String message, String from, String replyto, String toname, String fromname, String errorsto, boolean extra) throws IOException {
HashMap<String, LinkedList<String>> mails = Manager.getInstance().emails;
LinkedList<String> hismails = mails.get(to);
if (hismails == null) {