How to add a line in apex mail

In Salesforce, you can add a line to an Apex email using the addBody method of the Messaging.SingleEmailMessage class. Here's an example:

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setSubject('Test Email');
mail.setBody('Hello World!');
mail.addBody('This is an additional line of text.');

In this example, we create a new SingleEmailMessage object and set its subject and body. We then use the addBody method to add an additional line of text to the email body.

You can also use the addTextBody method to add a plain text body to the email, and the addHtmlBody method to add an HTML body.

mail.addTextBody('This is a plain text line.');
mail.addHtmlBody('<p>This is an HTML line.</p>');

Note that you can add multiple lines to the email body using the addBody method. Each call to addBody adds a new line to the email body.

Here's an example of how you can add multiple lines to an email body:

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setSubject('Test Email');
mail.setBody('Hello World!');
mail.addBody('This is the first line.');
mail.addBody('This is the second line.');
mail.addBody('This is the third line.');

In this example, we add three lines to the email body using the addBody method. The resulting email will have three lines of text.