[R] sendmailR-package-valid code needed

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Tue Aug 24 08:55:34 CEST 2010


On Tue, Aug 24, 2010 at 7:18 AM, veepsirtt <veepsirtt at gmail.com> wrote:
>
> I could not install Rmail Package .
> I got the following errors.
> Then how to do.please
>
>  library("caTools")
>> install.packages("Rmail",contriburl="http://www.math.mcmaster.ca/~bolker/R/src/contrib")
>
> Warning: dependency ‘caTools’ is not available
> trying URL 'http://www.math.mcmaster.ca/~bolker/R/src/contrib/Rmail_1.0.zip'
> Error in download.file(url, destfile, method, mode = "wb", ...) :
>  cannot open URL
> 'http://www.math.mcmaster.ca/~bolker/R/src/contrib/Rmail_1.0.zip'
> In addition: Warning message:
> In download.file(url, destfile, method, mode = "wb", ...) :
>  cannot open: HTTP status was '404 Not Found'
> Warning in download.packages(pkgs, destdir = tmpd, available = available,  :
>  download of package 'Rmail' failed

 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:

http://www.nixtutor.com/linux/send-mail-through-gmail-with-python/

 - 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:

http://kutuma.blogspot.com/2007/08/sending-emails-via-gmail-with-python.html

Barry



More information about the R-help mailing list