5

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

Example of what I want to modify

I want the company logo to appear there instead of the automatically generated A.

I want to achieve this:

enter image description here

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?

Mihail Minkov
  • 2,463
  • 2
  • 24
  • 41
  • 1
    https://stackoverflow.com/questions/43091844/send-email-with-profile-picture-php-mail-function – Rotimi Mar 18 '20 at 18:54
  • @Akintunde-Rotimi I checked that but I am not sure that's the only way to do this, moreover when a noreply@ address is used. Isn't there a way to customize this? – Mihail Minkov Mar 18 '20 at 18:59
  • 3
    The image is associated with the account. It isn't sent in the email. – user3783243 Mar 18 '20 at 19:00
  • So, what happens if the account doesn't exist? Or do I need to create an account and disable its inbox? – Mihail Minkov Mar 18 '20 at 19:09
  • Just as an additional question. What happens if there's already G-Suite enabled for that domain, is there a way to do this without creating another e-mail? It would cost $6 USD a month just to do that. – Mihail Minkov Mar 18 '20 at 19:16
  • Sending an email with a From header doesn't cost anything. If the From header matches I presume Google associates it to image record they have. They likely have some authentication they use though. That could easily be tested though. – user3783243 Mar 19 '20 at 01:34
  • So I should check for a specific account that has the logo and use it as a From header? @user3783243 – Mihail Minkov Mar 20 '20 at 18:00
  • Hi @MihailMinkov, is https://sendgrid.com/blog/what-is-bimi/ what you're trying to achieve? – Matthew Setter May 09 '23 at 13:25
  • @MatthewSetter ooh, this is new! The question is a little outdated now, but how much support is there for BIMI? – Mihail Minkov May 09 '23 at 16:59
  • Not sure, but I'll find out and get back to you. – Matthew Setter May 10 '23 at 08:23

0 Answers0