Tutorial

Tutorial

Download EmailAPI.jar and add it to your plugin's build path. This is not a Bukkit plugin, so you'll need to bundle it with your plugin instead of dropping it in the plugins folder and adding it as an external JAR.

You can now access the Email class, which is used for creating and sending an email. Here's a breakdown of all of the methods:

MethodExplanationSample Input
withSMTPServer()The SMTP server through which your email will be sent.smtp.gmail.com
withUsername()The username used to log into the email account.username@gmail.com
withPassword()The password used to log into the email accountpassword
withTo()The recipient of the email.you@gmail.com
withSubject()The subject of the email.This is the subject!
withBody()The body of the email.This is the body!
send()Send the email.

And here's some sample code:

import me.nrubin29.emailapi.Email;

new Email()
.withSMTPServer("smtp.gmail.com")
.withUsername("username@gmail.com")
.withPassword("password")
.withTo("you@gmail.com")
.withSubject("This is the subject!")
.withBody("This is the body!")
.send();

Comments

Posts Quoted:
Reply
Clear All Quotes