On Mon, Aug 23, 2010 at 3:55 PM, Velappan Periasamy <[hidden email]> wrote:
> Hello Chris Campbell ,
> I tried this for my email id it give me errors
>> from <- sprintf("<sendmailR@%s>", Sys.info())
>> to <- "< [hidden email]>"
>> subject <- "Hello from R"
>> msg <- "It works!"
>> sendmail(from, to, subject, msg,control=list(smtpServer="ASPMX.L.GOOGLE.COM"))
> Error in waitFor(code) :
> SMTP Error: 5.1.1 The email account that you tried to reach does not
> exist. Please try
> Calls: sendmail -> smtpSubmitMail -> sendCmd -> waitFor
> my email id is correct
The sendmail function in the sendmailR package can't send email via a
server that uses SMTP-Authentication. Gmail's smtp server, which is
called smtp.gmail.com, relies on SMTP AUTH to make sure you are who
you say you are. The sendmail function doesn't know how to respond.
It could be written to handle it, the outline of SMTP AUTH are here:
No, alas. It would have been nice but I decided I didn't need it that
badly/need to spend time reinventing that many wheels. (It does do
mail-merge, though, which is what I developed it for in the first
place.) It seemed to me that a more sensible solution would have been
to find a Perl or Python library/code fragment that knew the formats for
MIME attachments, but surprisingly (to me) I didn't easily discover
anything appropriate floating around on the web ...
Frank Harrell wrote:
> Ben does yours create mime attachments?
> Frank E Harrell Jr Professor and Chairman School of Medicine
> Department of Biostatistics Vanderbilt University
> On Mon, 23 Aug 2010, Ben Bolker wrote:
>> Barry Rowlingson <b.rowlingson <at> lancaster.ac.uk> writes:
>>> On Mon, Aug 23, 2010 at 3:55 PM, Velappan Periasamy <veepsirtt <at>
>>>> Hello Chris Campbell ,
>> I just posted my embryonic 'Rmail' package, which does a form
>> of SMTP authentication (maybe not the version you want), to
>> http://www.mathserv.mcmaster.ca/~bolker/R/src/contrib/Rmail_1.0.tar.gz >>
>> You should be able to install it via
>> (although not that it is a source package -- there's no compiled
>> code, though, so if necessary you can download the tarball and dig
>> the R source code out ...)
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code.
Unless Ben can provide a quick fix for this, you might be better off
taking his advice and using python - it comes with a full smtp
implementation that can easily send emails via gmail. Here it is in
about 12 lines of code, I've tried this and it works for me:
- just replace the username and password with yours and it should
work, assuming you have enabled POP and IMAP access in your gmail
settings, which seems to be a prerequisite for google's smtp access.
You can run python from R, exactly how may depend on your operating
system, using something like R's system() function.
Here's an example that sends attachments with the email, but I've not
tried or tested this: