Don’t stop now! The next scenario will only take about 10 minutes to complete.

Sending email with Ogham

Step 1 of 2

Step 1 - Your first email

Add Ogham dependency

___

Maven

    <dependency>
      <groupId>fr.sii.ogham</groupId>
      <artifactId>ogham-all</artifactId>
      <version>2.0.0</version>
    </dependency>
  

Gradle

    compile "fr.sii.ogham:ogham-all:2.0.0"
  

___

Prepare Ogham

MessagingService service = MessagingBuilder.standard()
        .environment()
            .properties()
                .set("mail.smtp.host", "host01")  // host available for demo email server
                .set("mail.smtp.port", "10025")   // smtp port available for demo email server
                .and()
            .and()
        .build();
import fr.sii.ogham.core.builder.MessagingBuilder;

Send your first email

service.send(new Email()
      .from("[email protected]")  // you can use anything you want as sender
      .subject("This is the subject of the email")
      .content("This is the content of the email")
      .to("[email protected]"));   // this is the email address used by the demo email server
import fr.sii.ogham.core.service.MessagingService;
import fr.sii.ogham.email.message.Email;

Build

___

Maven

mvn package

Gradle

gradle build

___

Run

java -cp target/your-artifact-0.0.1-SNAPSHOT.jar FirstEmail