A tiny, client-ship-ready mail endpoint for simple website forms.
AUTH LOGIN with optional STARTTLS / SSL (still zero deps).https://*.example.com)CCMail.php — mailer classmail-config.php — configmail-api.php — JSON API endpoint for your formscontact-form-example.html — integration exampleUpload the folder to somewhere that runs PHP, for example:
https://cdn.yourdomain.com/ccmail/
Make sure your server can write to:
sys_get_temp_dir() (default for logs/rate-limit), or customize paths in mail-config.php.Edit mail-config.php:
contact.to_emaildefaults.from_email and defaults.from_namesecurity.allowed_originsKeep:
'mode' => 'mail',
Set:
'mode' => 'smtp',
and fill smtp.host, smtp.username, smtp.password, etc.
Use the included contact-form-example.html or post JSON like:
fetch("https://cdn.yourdomain.com/ccmail/mail-api.php", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
name: "Luan",
email: "luan@example.com",
phone: "",
subject: "Hello",
message: "Testing",
website: "" // honeypot
})
})
mail() is unreliable