GmailR signature

27 views Asked by At

I'm trying to create an email for several companies in order to participate on a survey.

I would like to add my signature on the mail. I've read several forums where they explain the API issues regarding the signature.

However most of these forums have been created for mailr package and not gmailr specifically.

Now, if even with this package we can't add the signature in our mails, then can we at least add inline pictures with the signatures on the mails, using the gm_html_body() function.

Here a reprex.

gm_mime() %>% 
  gm_to("[email protected]") %>% 
  gm_from(" [email protected]") %>% 
  gm_subject(paste("Invitation")) %>% 
  gm_html_body(body = paste(glue("<p>Estimados Sres. <b>{total[['empresa']][k]}</b></p> \\
                                   <p> </p>\\
                                   <p>Atención Sr.(a) {total[['names']][k]}</p>\\
                                   <p> </p>\\
                                   <p><i>email</i> test no. {k}</p>"),
                             "<p>favor intentar enviarnos un correo siempre a {from}.</p> \\
                                  <p> Grupo focal verde validado </p>",
                                  "<h2> A plot of <b>MotorTrend</b> data <i>(1974)</i></h2>
                                  <img src='LOGO.jpeg'>"),inline = T) %>% 
  gm_attach_file('LOGO.jpeg') %>% 
  gm_create_draft()
1

There are 1 answers

4
r2evans On

Per the documentation, you need to attach the file (you are doing this) and assign an id= (missing), and reference that id in the img tag (doing this incorrectly).

Perhaps:

gm_mime() %>% 
  gm_to("[email protected]") %>% 
  gm_from(" [email protected]") %>% 
  gm_subject(paste("Invitation")) %>% 
  gm_html_body(body = paste(glue('<p>Estimados Sres. <b>{total[['empresa']][k]}</b></p> \\
                                   <p> </p>\\
                                   <p>Atención Sr.(a) {total[['names']][k]}</p>\\
                                   <p> </p>\\
                                   <p><i>email</i> test no. {k}</p>"),
                             "<p>favor intentar enviarnos un correo siempre a {from}.</p> \\
                                  <p> Grupo focal verde validado </p>',
                                  '<h2> A plot of <b>MotorTrend</b> data <i>(1974)</i></h2>
                                  <img src="cid:logo">'),inline = T) %>% 
  gm_attach_file("LOGO.jpeg", id="logo") %>% 
  gm_create_draft()