0

I have a HTML template with a list of people and each people have their own image, I'm trying to send an email with the src in base64 like this: <img src='data:image/png;base64,iVBORw0KGgoAAAA..., but it doesn't work because gmail does not allow this example of the list in gmail

I saw a couple of answers that the image should be embedded in the message as an attachment using this:

--boundary
Content-Type: image/png; name="sig.png"
Content-Disposition: inline; filename="sig.png"
Content-Transfer-Encoding: base64
Content-ID: <0123456789>
Content-Location: sig.png

base64 data

--boundary

Base64 images to gmail

But in my in case i have a foreach with multiples cards and each card have a profile picture so i don't know how to implement this.

              <table cellspacing='0' cellpadding='24' border='0' bgcolor='#ffffff' width='100%'>
              <tr>
                    <td align='center' style='padding-top:16px;padding-bottom: 10px;'>
                    <a href='#' style='color:#ffffff;text-decoration:none;cursor: pointer;'>
                        <table cellspacing='0' cellpadding='16' border='0' bgcolor='#EAEAEA' width='90%'>
                        <tr>
                            <td width='50' style='padding-bottom: 0px; padding-top: 0px;padding-right: 0px;'>
                            <a href='#' style='outline:none;'>
                                <img src='@Raw(@curriculo.Url_Profile)' alt='profile pic' style='width:50px;max-width:50px;min-height:auto;outline:none;text-decoration:none;display:block;border-radius: 50%;'>
                            </a>
                            </td>
                            <td align='left' style='padding-bottom: 0px; padding-left: 12px;'>
                            <p style='font-size:16px;color:#01579B;font-weight:bold;line-height:120%;'> @curriculo.Name</p>
                            <p style='font-size:15px;color:#004C40;font-weight:regular;line-height:120%;'> @curriculo.Age years</p>
                            <br />
                            </td>
                            <td align='right' style='padding-bottom: 0px; padding-right: 21px;padding-top: 0px;'>
                            <p style='font-size:16px;color:#004C40;font-weight:bold;line-height:120%;'>
                                <strong>R$ @curriculo.Salary</strong>
                            </p>
                            <p style='font-size:15px;color:#004C40;font-weight:normal;line-height:120%;'> @curriculo.Graduation </p>
                            </td>
                        </tr>
                        </table>
                        <table cellspacing='0' cellpadding='16' border='0' bgcolor='#EAEAEA' width='90%'>
                        <tr>
                            <td align='left'>
                            <p style='font-size:16px;color:#004C40;font-weight:bold;line-height:120%;'>
                                <strong>@curriculo.City / @curriculo.State </strong>
                            </p>
                            </td>
                            <td align='right' style='padding-top: 0px;'>
                            <table cellspacing='0' cellpadding='0' border='0' align='right' style='margin-top: 16px;'>
                                <tbody>
                                <tr>
                                    <td style='font-weight:bold;color:#ffffff;font-size:14px;text-decoration:none;cursor:pointer;font-family:Arial, Helvetica, sans-serif; padding-top: 8px;padding-bottom: 8px;padding-right: 32px;padding-left: 32px;background-color: #01579B; border-radius: 20px;'>
                                    <p>
                                        <strong>
                                        <a href='@Raw(@curriculo.Url_Ver_Perfil)' style='color:#FFF;line-height:100%;text-decoration:none;'>GO TO PROFILE</a>
                                        </strong>
                                    </p>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                            </td>
                        </tr>
                        </table>
                    </a>
                    </td>
              </tr>
              </table> } } 

I'm using C# to change the variables that come in the html and send it to gmail, so I replace the Curriculo_Url_Profile with the base64url and the final result is this

https://codepen.io/v4ipc/pen/WNZvodj

What can I do to get the image to load into gmail and if not in base64 how else can I convert the image to use correctly

  • Welcome to stack please edit your question and include [example] there is not enough code here to help you debug your issue. – DaImTo Dec 02 '21 at 09:51

0 Answers0