Generating Email from Name Column

I have a Spreadsheet (LibreOffice) file which includes a Column with Full Names.

I need to extract each name, create an Email address from it and insert it into a another column on the same row.

Email Addresses needs to be created in the form of: NAME.SURNAME@domain.com.

The Name column Includes names such as “Name Surname”

As an Example, if the Name column includes John Doe, I would like LinreOffice Calc to automatically insert John.Doe@domain.com in another Column in the same row.

Is it possible to create a Macro which will automatically parse and insert an Email address from the Name Column?

Formula like as

=HYPERLINK("mailto:"&SUBSTITUTE(TRIM(SUBSTITUTE(A2;"  ";" "));" ";".")&"@domain.com";SUBSTITUTE(TRIM(SUBSTITUTE(A2;"  ";" "));" ";".")&"@domain.com")

work fine for me (without any macro)

Thanks This Worked.

Would it Be possible to Change the Name with the Email Address inside the Same Cell?

As in, I Enter John Doe and Calc changes to John.Doe@domain.com

Okay. And if you mistype? For example write Jonh Deo? Let it be Jonh.Deo@domain.com ? (I mean, that after the correct a mistake macro can transform an address to John.Doe@domain.com@domain.com)