|MailR SMTP Setup (Gmail, Outlook, Yahoo) | STARTTLS Comment Translate Page||
The mailR package allows you to easily send e-mails with R, but you need the right mailR SMTP settings. Getting the SMTP settings just right to establish a connection to e-mail hosts like Gmail, Outlook, or Yahoo can be challenging. This is especially true when there are some settings you need to change on the host side to make everything work. In this post, I'll show you how to connect to the major e-mail providers such as Gmail, Outlook, Yahoo, Hotmail, and AOL. For each host, you'll get the SMTP host name, ports and login requirements. In addition, I'll show you how to deal with STARTTLS, the default secure communications protocol used by many major e-mail providers for SMTP. Incidentally STARTTLS is not supported by mailR as of (v0.4.1). To get mailR to work with these services, you'll need to alter your account settings to allow communication with “less secure apps”. Objective: Review Major Webmail Hosts Generic mailR SMTP Settings (SSL and TLS) Using R-mail to connect to major Hosts (STARTTLS) Possible Fix for mailR package Context – the mobileTrigger package Major Webmail Hosts If you want to send e-mails with R, and you use a webmail provider this article should get you moving in the right direction. To start, you need to know that outgoing e-mail is handled by SMTP servers. SMTP services are typically hosted by your internet service provider, website host, or other web-based services like search engines. While I can't cover all cases, this article will cover the generic mailR setup for SSL and TLS SMTP settings. SSL and TLS are secure e-mail transfer protocols. After discussing the general SMTP setup, we'll cover how to setup mailR for the big 5 webmail providers. Generic mailR SMTP Settings (SSL and TLS) To send e-mails with the mailR package, you use the send.mail() command. Here is a generic example: require(mailR) send.mail( from="[from email address]", to = "[to email address] ", subject = "The Subject line", body = "The message you want to send", smtp = list(host.name = "some.smtp.server.com", port = [PortNumber], user.name = "[from email address]", passwd = "[YourPassword]", #ssl = T #tls = T), authenticate = T, send = T ) Looking over the code, you see that several details are needed to send an email. Most important to our discussion are the SMTP settings starting on line 6. Usually you can find the SMTP details by searching for “SMTP and [whoever is hosting your mail service….]. Here is a quick summary of the most important arguments, you need: host.name : string, the name of the server you are trying to connect to (e.g., smtp.gmail.com) port : number, generally 465 (SSL) or 587 (TLS) user.name: string (email address), most often this is the e-mail address you are sending from. passwd: string, the password you use to sign into the mail server Security arguments TLS or SSL: If you choose the incorrect security protocol, the SMTP server may deny your request. Most of the major webmail providers support TLS. In my experience, establishing communication with an SMTP server is either SSL or TLS. If you are using SSL, the port number is usually 465 and for TLS the port is usually 587. Even so, it's very easy to get hung up on the server details… Especially, when you try both and it doesn't work. This is most common with the major webmail services (e.g, Gmail, Yahoo, etc), because they use a different protocol by default, STARTTLS. STARTTLS isn't supported by mailR but there are options. More on this below. Connecting to the Major Webmail Services (Gmail, Outlook, Yahoo, etc.) So, who are the major webmail services? My determination of the big 5 e-mail services was not particularly scientific. The best piece of data I found reporting the proportion of e-mail domains used was "List of most popular email domains” from 2016. Along with some other searches, it looks like the big 5 e-mail providers were “webmail” providers. Here is the shortlist Gmail Outlook Hotmail AOL Yahoo As mentioned in the previous section, some of these providers use STARTTLS. If they do, all your SMTP settings could be correct in your send.mail() command, and your connection will still be rejected by the SMTP server. In the table below, I've summarized the connection details for the major webmail providers and indicated which use STARTTLS. Provider host.name port SSL or TSL Uses STARTTLS R Snippet gmail smtp.gmail.com 587 TLS YES Code Outlook smtp.office365.com 587 TLS NO Code Yahoo smtp.mail.yahoo.com 587 TLS YES Code Hotmail smtp.live.com 587 TLS NO Code AOL smtp.aol.com 587 TLS YES Code ionos (my webhost) smtp.ionos.com 587 TLS NO Code Now, just because Gmail uses STARTTLS doesn't mean you can't use mailR. You can. But, there is an extra step required, and we'll discuss that in the next section. Dealing with STARTTLS Great, so you've got your sever details all set but the connection isn't working. The issue is likely that your host is using a STARTTLS security protocol. As of mailR (v0.4.1) STARTTLS isn't supported. One way to overcome the issue is to use your e-mail host's “less secure apps” option. Warning: using the “less secure apps” option will lessen your account security. So, change this setting with caution. Below is a quick summary of the types of errors I've encountered with Gmail, Yahoo, and AOL due to STARTTLS. Also, I've provided you with a direct link to the page where you can enable the “less secure apps” option, and some visuals describing where to make the necessary change. Gmail mailR(javamail) ERRORS:  org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.Gmail.com:587  Caused by: javax.mail.AuthenticationFailedException: 535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials c21sm18730030qkm.8 - gsmtp  Caused by: com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first. x14sm29391461qtc.44 - gsmtp Link to set less secure apps option: https://myaccount.google.com/security Yahoo mailR(javamail) ERRORS:  org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.mail.yahoo.com:587  Caused by: javax.mail.AuthenticationFailedException: 535 5.7.0 (#AUTH005) Too many bad auth attempts. Link to set less secure apps option: https://login.yahoo.com/account/security AOL mailR(javamail) ERRORS:  org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.aol.com:587  Caused by: javax.mail.AuthenticationFailedException: 535 5.7.0 (#AUTH005) Too many bad auth attempts. Link to set less secure apps option: https://login.aol.com/account/security Once you've enabled the “less secure apps” setting, try to run your mailR script again. It should work this time, assuming all your settings are correct. Engineering Note on STARTTLS Issue While the process mentioned above resolves the SMTP communication issues with these hosts, we are treating a symptom rather than the root cause. The best resolution is to have the STARTTLS option available in the mailR package. While I've not dug into the code behind the mailR package, it seems to be built on top of javaMail. And, JavaMail appears to have STARTTLS capabilities as suggested by this stackoverflow thread: https://stackoverflow.com/questions/5592112/javamail-smtp-properties-for-starttls. So, there is definitely an opportunity for improvement. Hotmail During the preparation of this article, I setup a Hotmail account and tried to send an e-mail using the mailR package. I got an error on the first attempt that wasn't STARTTLS related. It looked like this: mailR(javamail) ERRORS:  com.sun.mail.smtp.SMTPSendFailedException: 554 5.2.0 STOREDRV.Submission.Exception:OutboundSpamException; Failed to process message due to a permanent exception with message WASCL UserAction verdict is not None. Actual verdict is HipNotify, ShowTierUpgrade. OutboundSpamException: WASCL UserAction verdict is not None. Actual verdict is HipNotify, ShowTierUpgrade. [Hostname=BYAPR15MB3303.namprd15.prod.outlook.com]  org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.live.com:587 To solve this issues, I needed to send an e-mail from the Hotmail web interface to verify that I was not a robot. After I sent a test message, everything worked fine with mailR. Context For the last month or so, I've been working on the mobileTrigger package which provides a framework to interact with R scripts, reports, and models using your e-mail client. It is still a work in progress but essentially it's a functional extension of my previous post “Running Remote R Scripts with Mobile Devices using E-mail Triggers”. While developing the package, it became apparent that many of the webmail hosts didn't play nicely with R's mailR package out of the box. To that end, the goal of this article is to provide a resource to folks who'll want to use the mobileTrigger package and not waste lots of time struggling with their SMTP settings. Summary In this article, we learned how to get the mailR package to work with some of the major webmail providers including, Gmail, Outlook, and Yahoo. For each of these providers, the critical SMTP parameters in mailR's send.mail() command was given. You also learned that while all your SMTP settings may be correct, communications with the SMTP server can still be revoked if the provider uses the STARTTLS protocol. Examples of webmail providers that use STARTTLS included Gmail, Yahoo, and AOL. We wrapped up by showing how to get around this issue by changing the host-side settings concerning “less secure apps”. Other Articles at r-bar.net Running Remote R Scripts with Mobile Devices using E-mail Triggers Super Dark Mode Theme for R-Studio Learning and Teaching R | Get to the plot WooCommerce Image Gallery | Step by Step, Automate with R XmR Chart | Step-by-Step Guide by Hand and with R
The post MailR SMTP Setup (Gmail, Outlook, Yahoo) | STARTTLS appeared first on R-BAR.
|Comment Translate Page|
Obedience to the authorities and Romans 13
Romans 13 was for a long while held to support the divine right of kings. But does it? It is certainly a command to be a good citizen and one cannot easily object to that. But the idea that one should just accept anything that any government does is surely troubling. Even more troubling is the idea that all governments, however bad, were put there by God. So let's see where Paul may have been coming from in writing that.
I have previously suggested here and here that some of the commands to Christians given in the NT were not meant as instructions for all times but rather for the very transitional period when the first flowering of Christianity was in danger of being crushed under the feet of the established authorities, mostly Roman but also more local. The imperative was for the faith to survive but once that was firmly in place "normal" rules could apply. That helps us to understand the most disobeyed instruction in the Bible:
Ye have heard that it hath been said, An eye for an eye, and a tooth for a tooth: But I say unto you, That ye resist not evil: but whosoever shall smite thee on thy right cheek, turn to him the other also. And if any man will sue thee at the law, and take away thy coat, let him have thy cloke also. And whosoever shall compel thee to go a mile, go with him twain. Matthew 5:38
That advice runs against all nature. No-one naturally behaves that way. It is anti-instinctual. So it must have been designed for a very special occasion. And it was.
It seems to me that these were instructions Jesus gave in full knowledge of the hostility that already existed towards him and the great danger his followers would be in after his death. He wanted his teachings to survive his death and the disciples were to be the vehicle for that survival. So he gave them instructions which would minimize hostility towards them.
How do we know that these instructions were for a transitional period only? Easy. Many of his other instructions were quite martial. "He said to them, "But now if you have a purse, take it, and also a bag; and if you don't have a sword, sell your cloak and buy one.". Again: "Do not suppose that I have come to bring peace to the earth. I did not come to bring peace, but a sword". And Christ himself drove the moneychangers out of the temple. And when Simon Peter cut off the servant's ear with his sword, Jesus did not say that the use of the sword was wrong. He simply said that the time was wrong for that -- John 18:10.
And Romans 13 is clearly an elaboration of the instructions in Matthew 5. Paul was a good apostle. It reads:
Let everyone be subject to the governing authorities, for there is no authority except that which God has established. The authorities that exist have been established by God. Consequently, whoever rebels against the authority is rebelling against what God has instituted, and those who do so will bring judgment on themselves. For rulers hold no terror for those who do right, but for those who do wrong. Do you want to be free from fear of the one in authority? Then do what is right and you will be commended. For the one in authority is God’s servant for your good. But if you do wrong, be afraid, for rulers do not bear the sword for no reason. They are God’s servants, agents of wrath to bring punishment on the wrongdoer. Therefore, it is necessary to submit to the authorities, not only because of possible punishment but also as a matter of conscience. This is also why you pay taxes, for the authorities are God’s servants, who give their full time to governing. Give to everyone what you owe them: If you owe taxes, pay taxes; if revenue, then revenue; if respect, then respect; if honor, then honor.
Paul was writing in the very beginning of the Christian expansion and there was already hostility to their "strange" beliefs in the Greek cities where they were mostly to be found. So he wanted to instill attitudes of non-resistance to make them safe. That both he and Christ saw non-resistance as powerful was in fact amazing wisdom for the time. It was brilliant advice on how to survive hostility and danger. Psychologists these days teach "de-escalation techniques" for dealing with conflict but Christ and Paul taught such techniques 2,000 years ago.
But are we certain yet that the desire for a peaceful life lay behind those instructions? I think there is one more piece of evidence that clinches it. It is in I Timothy 2:
I exhort therefore, that, first of all, supplications, prayers, intercessions, and giving of thanks, be made for all men; For kings, and for all that are in authority; that we may lead a quiet and peaceable life in all godliness and honesty
So it is clear that deflection of aggression from the authorities is the single theme of Matthew 5, Romans 13 and 1 Timothy 2. And in those times deflecting hostility was vital if the faith was to survive. Being known as good people would help them survive.
But what if the survival of the faith is no longer threatened, as is the case in the modern world, with its billions of Christians? I think in that case the instructions continue as useful tools but they are not something mandatory. They were instructions for a particular time and circumstance. So we may no longer use swords but armed self-defense is allowed. But Christian forgiveness still is a wise response to many conflict situations in 1 to 1 relationships.
So was Paul pulling a fast one in telling us that all governments were ordained by God? Was he telling a white lie in order to get the early Christians to behave?
He was not. He was simply re-iterating the doctrine of predestination, as found in Ephesians chapter 1. John Calvin was much taken by that doctrine and did much to elaborate it and it survives as an official doctrine of Presbyterian churches to this day. It is even preached in the 39 Articles of Religion of the Church of England, albeit in a rather strangled way. That does however raise new issues so I will leave a discussion of it for another day.
Leftists Whipping Themselves Into a Jacobin Frenzy
There's no question that animosity exists on both sides of the political spectrum, but have you noticed how personal it has become for many on the left?
It is disturbing how intolerant and filled with rage leftist extremists have become, and how many more people are falling into the category of leftist extremism.
But what concerns me as much as this pattern of ill will and abuse from leftists is that it is unchecked by their peers and often applauded. Instead of encouraging people to appeal to the better angels of their nature, they are beckoning them to summon their demons and become part of a mob mentality — as if we're witnessing a replay of events that preceded the French Revolution.
It's unsettling that they rationalize their misbehavior as justified, even warranted. They've convinced themselves that conservatives' views are so noxious they've forfeited any expectation to be treated civilly and they deserve to be shunned, muzzled and boycotted — especially members of minority groups who have strayed from the reservation. They are "garbage people," "deplorables" and subhumans who are not entitled to equal rights, let alone decent treatment.
Leftist mobs violently protest conservative campus speakers and harass conservatives such as Kirstjen Nielsen, Sarah Huckabee Sanders, Pam Bondi, Mitch McConnell and Stephen Miller in public places. Conservatives are censored on Twitter and Facebook. Google, the mainstream media and other social media platforms refused to run ads for the pro-life movie "Unplanned," and Twitter often censors pro-life tweets.
Conservative students are shamed into silence on college campuses while their ideas are demonized in the surreal cause of promoting diversity and inclusiveness. Leftist students vandalize pro-conservative posters and seek to eradicate tributes to conservatives — such as the efforts by students at the Savannah College of Art and Design to remove the name of Savannah native Justice Clarence Thomas from one of the campus buildings because he is "anti-woman." Anti-woman? Just how crazed are these people?
Students at the University of California, Davis protested a photo of a heroic slain woman police officer holding a Thin Blue Line flag as "anti-black" and "disrespectful." For some, nothing is sacred, and to those lusting after another opportunity to be offended, everything is a provocation. Leftist protestors pepper-sprayed a group of high school kids meeting about free markets and the Constitution. Though many were hospitalized, the media ignored the event.
New York City Mayor Bill de Blasio impotently called for a boycott of Chick-fil-A's Manhattan restaurant because the chain owner, Dan Cathy, is a Christian who believes in traditional marriage. If you oppose Obamacare, it's not because you believe there is a better way to improve health care but because you don't want children to have access to it — as Jimmy Kimmel unapologetically asserted. If you support Social Security reform, you want old people to get sick or die. If you favor border enforcement, you are a xenophobe and a racist. If you oppose abortion, you want to deprive women of their autonomy and health care.
This is the kind of pervasive demonization of conservatives that leftists are engaging in every day, which leads to the horrific mentality that it's OK to deprive them of their rights and treat them as second-class citizens.
Luke O'Neil, in an op-ed in The Boston Globe, expressed regret that when he waited on Bill Kristol at a restaurant 10 years ago, he did not insult him and spoil his food with urine and blood. Ironically, Kristol is one of President Trump's most ardent critics today, but a decade ago he was the bane of the left because of his support for America's war with Iraq. O'Neil remembered having served Kristol when he learned that Secretary of Homeland Security Kirstjen Nielson resigned her post this week. He fondly recalled her being "shame-marched" out of a restaurant nine months ago because of the Trump policy that allegedly separates families at the southern border. He suggested that waiters would have been serving America if they had tampered with Nielsen's food. Far from being sorry for his piece, O'Neil later tweeted in response to conservative criticism, "People who carry out policies of ethnic cleansing or cheerlead for disastrous wars leading to tens of thousands of suffering or dead should not expect to be able to show their faces in public anymore thank you for understanding this basic premise."
Such unbridled personal nastiness reminded me of liberal writer Jonathan Chait's admission in 2003 that he loathed then-President Bush. What was most striking was not his antipathy but that he knew he risked nothing in sharing it — that the people whose respect he cared about would approve and think no less of him. He wrote: "I hate President George W. Bush. There, I said it. ... I hate the inequitable way he has come to his economic and political achievements and his utter lack of humility (disguised behind transparently false modesty) at having done so. ... I hate the way he walks — shoulders flexed, elbows splayed out from his sides like a teenage boy feigning machismo. I hate the way he talks — blustery self-assurance masked by a pseudopopulist twang. I even hat the things that everybody seems to like about him."
The left's extremism — its embracing of ever nuttier ideas, its sanctimonious hubris, its routine descent into personal ugliness, its relishing of incivility, its willful censorship, its discrimination against Christians and its dehumanization of conservatives and Trump supporters — is growing at an alarming pace. I pray that adults remaining on that side of the aisle can someday regain control of this careening leftist political juggernaut.
50 year low in unemployment insurance claims
Americans for Limited Government President Rick Manning today issued the following statement on the latest unemployment claims numbers:
“Job growth in the Trump economy continues at an incredible pace with both the weekly unemployment insurance claims and what is considered the more reliable four week rolling average of the claims both reached levels not seen since 1969, when the workforce was approximately half the size compared to today.
“Unemployment insurance claims measure how many people are being displaced in the economy, and the 2019 Trump economy has fewer claims than 1969, the year that Neil Armstrong and Buzz Aldrin first walked on the moon. The fact that America is going back to work is not a secret, but this record low of people facing the fear and uncertainty of being let go from their job is remarkable.”
I Wanted to Help Google Make AI More Responsible. Instead I Was Treated With Hostility
Kay Coles James
Google decided this year to create an advisory council that would help guide the company in the responsible development of artificial intelligence. When the company asked me to join, I agreed, welcoming the opportunity to contribute my perspective as a conservative leader — and to test my thinking with council members who might not necessarily agree with me. Together, I thought, we might be able to make valuable contributions as Google explores an important new frontier of technology.
Like many businesses and nonprofits, my organization, the Heritage Foundation, relies on Google search, YouTube and other Google products to promote our work, to reach audiences and to advance our mission. We’re also concerned about reports alleging that Google suppresses conservative voices and politically skews its search-engine results. It was reassuring to be invited to participate in the AI advisory council — a sign that Google wanted to treat a wide range of viewpoints fairly as it develops new technology. Given the massive control exerted by social media and Internet companies over the information Americans use every day, such broadmindedness is essential.
Unfortunately, some individuals inside and outside the company didn’t share this appreciation for a diversity of viewpoints. That became clear last month after the members of the advisory council were announced. Some Google employees were so alarmed by the prospect of a conservative invading their playground that they started a petition to have me removed from the panel. It gained more than 2,500 signatures.
But the Google employees didn’t just attempt to remove me; they greeted the news of my appointment to the council with name-calling and character assassination. They called me anti-immigrant and anti-LGBTQ and a bigot. That was an odd one, because I’m a 69-year-old black woman who grew up fighting segregation.
Last week, less than two weeks after the AI advisory council was announced, Google disbanded it. The company has given in to the mentality of a rage mob. How can Google now expect conservatives to defend it against anti-business policies from the left that might threaten its very existence?
I was deeply disappointed to see such a promising idea abandoned, but the episode was about much more than just one company’s response to intolerance from the self-appointed guardians of tolerance.
It was symptomatic of where America is heading. Whether in the streets or online, angry mobs that heckle and threaten are not trying to change hearts and win minds. They’re trying to impose their will through intimidation. In too many corners of American life, there is no longer room for disagreement and civil discourse. Instead, it’s agree or be destroyed.
My fellow advisory-council members have now been deprived of the opportunity to question me about what they might see as the contradiction of my policy views and my absolute unconditional acceptance of every member of the human family. They may not have agreed with me, but they would have understood me better — and I, them. With that, we would have had the opportunity to work together to make better public policy on an exceedingly critical issue.
I believe there are many opportunities for a civil discussion of religious values and how they conflict with other values. Some on the left are willing to engage in such an open-minded debate. But too often those on the left are turning into the very thing they say they despise, using hate and stereotyping to try to silence anyone they regard as an enemy. The public square is becoming so poisonous that good liberals and good conservatives must be wary of coming together to discuss ideas and seek solutions.
Being attacked is not new for me. As a black, conservative, pro-life, evangelical woman, I have spent most of my life being called names and being denounced for my beliefs.
In 1961, at age 12, I was one of two-dozen black children who integrated an all-white junior high school in Richmond. White parents jeered me outside the school, and inside, their kids stuck me with pins, shoved me in the halls and pushed me down the stairs. So when the group of Google employees resorted to calling names and making false accusations because they didn’t want a conservative voice advising the company, the hostility was reminiscent of what I felt back then — that same intolerance for someone who was different from them.
Uncivil discourse is an illness in America. We can do better — we must strive to show the world what a pluralistic society should be, a place where people of different faiths and viewpoints are willing to engage and willing to listen to others, especially when they bring different ideas to the table. From those conversations come a deeper understanding and better policies — and ultimately a better, more civil society for all.
For more blog postings from me, see TONGUE-TIED, EDUCATION WATCH INTERNATIONAL, GREENIE WATCH, POLITICAL CORRECTNESS WATCH, AUSTRALIAN POLITICS, and Paralipomena (Occasionally updated), a Coral reef compendium and an IQ compendium. (Both updated as news items come in). GUN WATCH is now mainly put together by Dean Weingarten. I also put up occasional updates on my Personal blog and each day I gather together my most substantial current writings on THE PSYCHOLOGIST.
Email me here (Hotmail address). My Home Pages are here (Academic) or here (Pictorial) or here (Personal)