I used the following method to send emails
prepare_and_send <- function(sender, recipient,
title, text,
attachment) {
email <- gm_mime() %>%
gm_to(recipient) %>%
gm_from(sender) %>%
gm_subject(title) %>%
gm_html_body(text) %>%
gm_attach_file(attachment, type = "pdf")
email <- gm_attach_part(email,msg) %>%
gm_send_message()
}
addresses %>%
mutate(
to = sprintf('%s <%s>', name, email),
from = email_sender,
subject = sprintf('Logistic options for %s', name),
msg = sprintf('Dear %s, %s',name,info),
attachment = sprintf('%s.pdf', attach)) %>%
mutate(x = pmap(list(from, to, subject, msg, attachment),
safely(prepare_and_send)))
I used a CSV file to feed the email recipients and attachments to the 'mime' object.
This is how I authenticated my Gmail API
#Authantication to GmailAPI
use_secret_file("BulkEmailCredentials.json")
gm_auth_configure(key = "client_id",
secret = "client_secret"
)
I could successfully send about 500 emails yesterday and I got the following errors afterwards. Error 1:
You have reached a limit for sending mail. Your message was not sent.
Error 2 (example):
Your message to info@carcare.sk has been blocked. See technical details below for more information.
But today I could end only about 150 emails
I also find address not found
error for about half of the emails.
I would appreciate it very much if you can explain, the Gmail API limitations and the reason for the above errors?