# sendmail **Repository Path**: maxproject/sendmail ## Basic Information - **Project Name**: sendmail - **Description**: javax.mail 发送邮件程序 。 EmailUtil 支持outlook或者office365邮箱发送和一般的邮件服务器发送。 EmailUtilV1不支持outlook或者office365邮箱发送,只支持一般的邮件服务器发送。 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-11-13 - **Last Updated**: 2025-11-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # sendmail A simple Java email sending tool ## Project Overview This project provides two Java email sending utility classes: - `EmailUtil`: This program supports sending emails from Outlook or Office 365 email accounts, as well as other general email servers. - `EmailUtilV1`: This program does not support sending via Outlook or Office 365 email, but only supports sending via general email servers. ## Features - Supports SMTP protocol for sending emails - Supports setting sender, recipients, CC, and BCC - Supports setting email subject and content - Supports sending attachments - Provides two different styles of utility class implementations ## Usage Examples ### Sending Email with EmailUtil ```java // Basic email sending String result = EmailUtil.sendEmail("smtp.example.com", "587", "user@example.com", "password", "from@example.com", "to@example.com", "Test Subject", "Test Content"); // Sending with attachment String result = EmailUtil.sendEmail("smtp.example.com", "587", "user@example.com", "password", "from@example.com", "to@example.com", "cc@example.com", "bcc@example.com", "Test Subject", "Test Content", "/path/to/file.txt"); ``` ### Sending Email with EmailUtilV1 ```java // Send email using configuration parameters Map params = new HashMap<>(); params.put("smtpHost", "smtp.example.com"); params.put("smtpPort", "587"); params.put("smtpUser", "user@example.com"); params.put("smtpPwd", "password"); params.put("fromMail", "from@example.com"); params.put("toMail", "to@example.com"); params.put("emailSubject", "Test Subject"); params.put("emailContent", "Test Content"); Map result = EmailUtilV1.sendMail(params); ``` ## Project Structure ``` src/ ├── main/ │ └── java/ │ └── javaxmail/ │ └── mail/ │ ├── EmailUtil.java # Basic email utility class │ └── EmailUtilV1.java # Configuration-based email utility class ├── test/ └── pom.xml ``` ## Dependencies The project is built with Maven and requires a Java 8+ environment. ## License This project is released under the Apache 2.0 License.