# 
        Mail Api
    
Before proceeding with further illustration, it is mandatory to have an API Key for using the SDK. If you don't have a Mailkeets API Key, please refer to this page for instructions on how to generate one.
        # 
        Methods in the SDK
    
        # 
        Send mail
    
With this method, You can send email to your recipient. There are some mandatory fields you have to provide.
- to : The recipient's email address.
- fromName : The name of the person or organization.
- fromAddress : The email address from which your message will be sent.
- subject : A brief description or summary of the content of the email.
- body : The main content of your email. requestIdentifier : A unique UUID that you can use to track your email later. You have to provide this field.
- unsubscribedList : A list of email addresses or contacts that have requested to be removed from a particular email marketing or mailing list. When someone unsubscribes from a mailing list, it means that they no longer wish to receive emails from the sender or organization, and they have opted out of future communications.
💡 Know More about One-Click Functionality for Unsubscribe
 
    
Please refer RFC-8058 to know more about how single click unsbuscribe functionality.
Header value for List-Unsubscribe looks like this in the raw email
 
    
sendMail.java
class Demo {
    private KursahaClient kursahaClient;
    private MailRequestDto requestDto;
    // Create a random UUID
    private final String requestIdentifier = UUID.randomUUID().toString();
    public static void main(String[] args) {
        String apiKey = "<replace-me-with-api-key>";
        // Create an object of KursahaClient
        kursahaClient = new KursahaClient(apiKey);
        /**
         * Create a MailRequestDto object
         * If you don't want to send unsubscribedList, you can add empty string.
         */
        requestDto = new MailRequestDto(
            "John", // fromName
            "john@doe.com", // fromAddress
            "hello@test.com", // to
            "This is test subject", // subject
            "This is test body", // body
            requestIdentifier, // requestIdentifier
            "<mailto:unsubscribe@example.com>, <http://www.unsubscribe.example.com/>" // unsubscribedList
    );
        MailResponseDto responseDto = kursahaClient.mk.sendMail(requestDto);
        System.out.println("got trace Id as: ", responseDto.getTraceId());
    }
}dto := mailkeets.MailRequestDto{
    FromName:          "Bob",
    FromAddress:       "bob@joe.com",
    To:                "receiver@gmail.com",
    Subject:           "Hello from golang",
    ContentType:       "text/plain",
    Body:              "This is go lang sample",
    RequestIdentifier: uuid.New().String(),
    UnsubscribedList:  "",
}
err := client.Mk.SendEmail(dto)
if err != nil {
    print(err.Error())
} else {
    print("successfully send mail!")
}curl --location 'https://mailkeets.kursaha.com/api/mail-send' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <replace-with-api-key>' \
--data-raw '{
    "fromName": "John",
    "fromAddress": "john@doe.com",
    "to": "hello@test.com",
    "subject": "This is test subject",
    "body": "This is test subject",
    "requestIdentifier": "800367b7-3b3a-423c-8006-eb63cc34c13c",
    "unsubscribedList": "<mailto:unsubscribe@example.com>, <http://www.unsubscribe.example.com/>"
}'
        # 
        Get all verified domains:
    
This method returns all verified domains saved in your account.
Demo Code Snippet
class Demo {
    private KursahaClient kursahaClient;
    public static void main(String[] args) {
        String apiKey = "<Demo-Api-key>";
        // Create an object of KursahaClient
        kursahaClient = new KursahaClient(apiKey);
        System.out.println(kursahaClient.mk.getVerifiedDomains());
    }
}#todocurl --location 'https://mailkeets.kursaha.com/api/sender-identities/verified-domains' \
--header 'Authorization: Bearer <replace-with-api-key>'