Jakarta Mail
| Jakarta Mail | |
|---|---|
| Basisdaten
| |
| Entwickler | Oracle |
| Erscheinungsjahr | 1996[1] |
| Aktuelle Version | 2.1.5[2] (30. September 2025) |
| Betriebssystem | plattformunabhängig |
| Programmiersprache | Java |
| Kategorie | API |
| Lizenz | GNU General Public License, Version 2, Common Development and Distribution License version 1.1 |
| projects.eclipse.org/projects/ee4j.mail | |
Jakarta Mail (früher JavaMail) ist eine Java-Programmierschnittstelle zum Plattform- und Protokoll-unabhängigen Senden und Empfangen von E-Mails. JavaMail unterstützt dabei die Standards SMTP, POP3 und IMAP.
Die JavaMail-API ist Teil der Jakarta-EE-Plattform, kann aber auch als optionales Paket von der Java Standard Edition aus verwendet werden.
Verwendung
Folgend ein Codefragment für die Verwendung von JavaMail 1.4.4 mit Nutzung eines SMTP-Servers. Die jeweiligen Daten sind beim Provider einzuholen.
final Properties props = new Properties();
props.put("mail.smtp.host", "SMTPHOST");
props.put("mail.smtp.port", "PORTNUMBER");
props.put("mail.transport.protocol","smtp");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.tls", "true");
props.put("mail.smtp.ssl.checkserveridentity", "true");
final javax.mail.Authenticator auth = new javax.mail.Authenticator() {
@Override
public PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("[email protected]","PASSWORD");
}
};
Session session = Session.getDefaultInstance(props, auth);
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress("[email protected]", "EXAMPLENAME"));
msg.addRecipient(Message.RecipientType.TO, new InternetAddress("[email protected]", "TOEXAMPLE"));
msg.setSubject("SUBJECT");
msg.setText("THE MESSAGE");
msg.saveChanges();
Transport.send(msg);
Alternativen
GNU-JavaMail ist eine weitere Open-Source-Implementierung der JavaMail-API. Es implementiert JavaMail 1.3 und neben den Protokollen SMTP, IMAP und POP3 auch NNTP, UNIX mbox und Dan Bernsteins Maildir-Format.[3]
Weblinks
Einzelnachweise
- ↑ JavaMail™ API - A Technical Overview. (PDF) S. 4.
- ↑ Release 2.1.5. 30. September 2025 (abgerufen am 20. Oktober 2025).
- ↑ GNU JavaMail Homepage
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.