Package net.bugreaper.modules.email
Class Email.EmailBuilder
java.lang.Object
net.bugreaper.modules.email.allure.AllureStepBuilder<Email.EmailBuilder>
net.bugreaper.modules.email.Email.EmailBuilder
- All Implemented Interfaces:
EmailBuilderInt
- Enclosing class:
public static class Email.EmailBuilder
extends AllureStepBuilder<Email.EmailBuilder>
implements EmailBuilderInt
Fluent builder for constructing complex emails.
Supports:
- Multiple attachments
- Multiple To, Cc. Bcc, ReplyTo
- Custom headers or tags
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds an attachment using automatic content type detection.Adds a "BCC" (blind carbon copy) recipient.Adds a "CC" (carbon copy) recipient.Adds a custom header in<key>format.addReplyTo(String email) Adds a "Reply-To" address.Adds a tag to the aggregatedX-Tagsheader.Adds a "TO" recipient.voidsend()Builds and sends the email.Set a "FROM" sender.Methods inherited from class net.bugreaper.modules.email.allure.AllureStepBuilder
startStep, step, stopStepFailed, stopStepSuccess
-
Constructor Details
-
EmailBuilder
-
-
Method Details
-
setFrom
Description copied from interface:EmailBuilderIntSet a "FROM" sender.- Specified by:
setFromin interfaceEmailBuilderInt- Parameters:
email- sender email address- Returns:
- this builder instance for chaining
-
addTo
Description copied from interface:EmailBuilderIntAdds a "TO" recipient.This method can be called multiple times to add multiple recipients.
- Specified by:
addToin interfaceEmailBuilderInt- Parameters:
email- recipient email address- Returns:
- this builder instance for chaining
-
addCc
Description copied from interface:EmailBuilderIntAdds a "CC" (carbon copy) recipient.CC recipients are visible to all other recipients.
This method can be called multiple times to add multiple carbon copies.
- Specified by:
addCcin interfaceEmailBuilderInt- Parameters:
email- CC email address- Returns:
- this builder instance for chaining
-
addBcc
Description copied from interface:EmailBuilderIntAdds a "BCC" (blind carbon copy) recipient.BCC recipients are hidden from other recipients.
This method can be called multiple times to add multiple blind carbon copies.
- Specified by:
addBccin interfaceEmailBuilderInt- Parameters:
email- BCC email address- Returns:
- this builder instance for chaining
-
addReplyTo
Description copied from interface:EmailBuilderIntAdds a "Reply-To" address.If multiple addresses are added, all will be included in the Reply-To header.
- Specified by:
addReplyToin interfaceEmailBuilderInt- Parameters:
email- reply-to email address- Returns:
- this builder instance for chaining
-
addAttach
Description copied from interface:EmailBuilderIntAdds an attachment using automatic content type detection.- Specified by:
addAttachin interfaceEmailBuilderInt- Parameters:
name- file name as it will appear in the emailfilePath- path to the file in test resources- Returns:
- this builder instance for chaining
-
addTags
Description copied from interface:EmailBuilderIntAdds a tag to the aggregatedX-Tagsheader.Multiple calls will accumulate values into a single header:
X-Tags: tag1,tag2,tag3
- Specified by:
addTagsin interfaceEmailBuilderInt- Parameters:
tag- tag value- Returns:
- this builder instance for chaining
-
addHeader
Description copied from interface:EmailBuilderIntAdds a custom header in<key>format.Example:
addHeader("X-env", "qa") → X-env: qa- Specified by:
addHeaderin interfaceEmailBuilderInt- Parameters:
key- header keyvalue- header value- Returns:
- this builder instance for chaining
-
send
public void send()Description copied from interface:EmailBuilderIntBuilds and sends the email.- Specified by:
sendin interfaceEmailBuilderInt
-