So, what I am doing is I am using Sendgdrid's API (PHP API Library) to send e-mails. The sending part works, I just want to overhaul it a little to add some more customization, but I am not sure if it's possible. I am using CodeIgniter so I am skipping some code, but you get the general idea.
What I want to achieve is to customize this part
I want the company logo to appear there instead of the automatically generated A.
I want to achieve this:
Is there some header I need to modify?
My mail sending process is this (fictional data):
$email = new \SendGrid\Mail\Mail();
$email->setFrom("noreply@mail.com", "Sender Name");
$email->setSubject("Mail Subject");
$email->addTo($mail_data->email, $mail_data->name);
$email->addContent(
"text/html", $this->load->view('mails/recovery', $mail_data, TRUE)
);
$sendgrid = new \SendGrid($this->config->item('sendgrid_api_key'));
try {
$response = $sendgrid->send($email);
// do some stuff
} catch (Exception $e) {
// do some other stuff
}
So the mail arrives correct and everything, but is there a way to add like an avatar for the mail sender? Like the company's logo or something. Is there a way to do this via code?
I checked something about creating a google account, but what if I am using a noreply@ address and also what happens if for another mail I use a different address? I'd have to add google accounts to each one?
So, based on Matthew Setter's comment on my question, I researched a little bit and the solution to this is the BIMI DNS record. BIMI stands for Brand Indicators for Message Identification
It requires the following:
You need an SVG version of your icon/logo/pic and the max weight of the image must be 32kb. The image must be publicly accessible, so it must be something like https://www.yourdomain.com/images/icon.svg
You need a BIMI Certificate, that's the tricky part, because they are currently extremely expensive, Digicert sells them as Verified Mark Certificate and they cost $1,499.00 USD per year, so it won't do for most people. You also need to host the certificate also on your domain on a public link, something like https://www.yourdomain.com/cert/bimi.pem
You need to have a defined DMARC policy, if you don't have one it might show warnings/errors.
You need to add a TXT record with the following structure
The name of the record is: default._bimi
v (version) BIMI1: v=BIMI1;
l (location) of the SVG image: https://www.yourdomain.com/images/icon.svg
a (address I think) of your certificate: https://www.yourdomain.com/cert/bimi.pem
So the end result is something like this:
TXT default._bimi "v=BIMI1;l=https://www.yourdomain.com/images/icon.svg;a=https://www.yourdomain.com/cert/bimi.pem" 3600
I hope the certificate authorities reduce the price of this as it can be useful for many businesses but $1,499.00 for a certificate is way too much for the regular business owner.
OTHER RESOURCES
You can also use these tools to generate/validate BIMI records.