the first command in your post
#3 (above) generates a key and a self-signed certificate. the key is saved in /etc/ssl/private/mail.key, and the certificate in /etc/ssl/certs/mailcert.pem. that should be enough to test your services.
if you need a certificate signed by a reputable CA, you'd need to run the second command in that post, instead. that would generate a key and CSR. you'd then submit the CSR (not the key), along with a fee, to the CA for signing.
quick review: the "key" mentioned above is your private key, which you don't divulge to anyone. the "certificate" is your public key together with a "signature" from a CA attesting to your identity (i.e. attesting that the public key belongs to the you).
in the case of a self-signed certificate, you use your own private key to "sign" the certificate.