I am trying to send myself a test email from an AWS Virtual Machine (using an EC2 instance.)
My R code runs great, but I am now trying to send a test email to my email address using sendmailR.
I get the following error message:
Error in socketConnection(host = server, port = port, blocking = TRUE) :
cannot open the connection
In addition: Warning message:
In socketConnection(host = server, port = port, blocking = TRUE) :
localhost:25 cannot be opened
install.packages("sendmailR")
library(sendmailR)
sendmail(from = "XXXX#gmail.com",
to = "YYYY#gmail.com",
subject = "Subject of the email",
body = "Body of the email",
smtp = list(host.name = "smtp.gmail.com", port = 80 , user.name = "XXXX#gmail.com", passwd = "XXXX", ssl = TRUE),
authenticate = TRUE,
send = TRUE)
Does anyone know how this is overcome?
Related
I am using amazon service and created rabbitmq broker now from the DOT NET code i am trying to connect to this broker.
var factory = new ConnectionFactory
{
Uri = new Uri("amqps://it:Password#hostname:5671")
};
var connection = factory.CreateConnection();
I am struggle here to get connection getting below error :
None of the specified endpoints were reachable
at RabbitMQ.Client.ConnectionFactory.CreateConnection(IEndpointResolver endpointResolver, String clientProvidedName)
Update:
It seems your client wants to connect using TLS/SSL (your uri specifies the protocol "amqps" and the port 5671).
Try enabling TLS/SSL:
var factory = new ConnectionFactory {
UserName = userName,
Password = password,
VirtualHost = "/",
HostName = hostName,
Port = port,
Ssl = new SslOption
{ Enabled = true, // <--------
ServerName = hostName }
};
The (JVM based) guide shows how to configure the connection factory. It sets the credentials on the factory, not in the URI:
ConnectionFactory factory = new ConnectionFactory();
factory.setUsername(username); // <----------
factory.setPassword(password); // <----------
//Replace the URL with your information
factory.setHost("b-c8352341-ec91-4a78-ad9c-a43f23d325bb.mq.us-west-2.amazonaws.com");
factory.setPort(5671);
// Allows client to establish a connection over TLS
factory.useSslProtocol()
// Create a connection
Connection conn = factory.newConnection();
(This needs to be translated to the corresponding .NET code)
When I upload this code to the web Shiny can't load it. When I enter Shiny it tells me the following error:
nanodbc/nanodbc.cpp:983: 00000: [unixODBC][FreeTDS][SQL Server]Unable to connect to data source [unixODBC][FreeTDS][SQL Server]Unexpected EOF from the server [unixODBC][FreeTDS][SQL Server]Adaptive Server connection failed
library(DBI)
library(odbc)
server = function(input, output, session) {
is_local = Sys.getenv('SHINY_PORT') == ""
server = "server"
database = "base"
uid = "login"
pwd = "pwd"
dbConnector <- function(server, database, uid, pwd,
local=TRUE, port=1433, tds_version=8.0,
Encrypt=yes, TrustServerCertificate=no){
if(local){
DBI::dbConnect(odbc::odbc(),
driver = "ODBC Driver 17 for SQL Server",
server = server,
database = database,
uid = uid,
pwd = pwd
)
}else{
DBI::dbConnect(odbc::odbc(),
driver = "FreeTDS",
server = server,
database = database,
uid = uid,
pwd = pwd,
port = port,
tds_version = tds_version
)
}
}
conn <- dbConnector(server, database, uid, pwd, is_local)
#Criando as tabelas dentro do servidor
df <- dbGetQuery(conn, 'SELECT * FROM TABLE')
)
Can someone help me?
It's like I have contact Sendrid to hear about how I may not send email.
That's because I need a username and password to be able to do that.
Sendgrid say on Twitter (PM)
For sending mail through SMTP, you will want to set your host to http://smtp.sendgrid.net . You can then use port 587, 2525 or 25 for TLS connections, and can use either your SendGrid username/password for authentication, or an API key generated on your account.
Code:
var resultMail = await _viewRenderService.RenderToStringAsync("~/Views/Templates/NewPassword.cshtml", viewModel);
var api = Environment.GetEnvironmentVariable("azure_xxxxxxx#azure.com");
var client = new SendGridClient(api);
var from = new EmailAddress("hello#hello.com", "J. Petersen");
var to = new EmailAddress("test#test.com", "Test");
var plainTextContent = Regex.Replace(resultMail, "<[^>]*>", "");
var msg = MailHelper.CreateSingleEmail(from, to, title, plainTextContent: plainTextContent,
htmlContent: null);
var resulta = client.SendEmailAsync(msg);
I have looked at Documentation on Sendgrid, and I do not think I'll find that you need to use username and password and port.
It is built in .net core 2.0 - Problems are how can I add my username and password and port to this?
Your using the API not SMTP, Here is the standard smtp
var mailMessage = new MailMessage
{
From = new MailAddress("support#bla.net"),
Subject = "Hello World",
Body = "Test email from Send Grid SMTP Settings"
};
mailMessage.To.Add("someone#somehwere.net");
var smtpClient = new SmtpClient
{
Credentials = new NetworkCredential("Your-Username#azure.com", "Your-Password"),
Host = "smtp.sendgrid.net",
Port = 587
};
smtpClient.Send(mailMessage);
Fresh installation (postfix-dovecote-roundcode) without reserving domain name just VPS IP i can't sent any mail from web but i can sent normally from terminal, it'r return SMTP Error (-1): Connection to server failed
/var/log/mail.log
Jan 7 05:28:04 mail postfix/submission/smtpd[9541]: connect from localhost[127.0.0.1]
Jan 7 05:28:04 mail postfix/submission/smtpd[9541]: lost connection after UNKNOWN from localhost[127.0.0.1]
Jan 7 05:28:04 mail postfix/submission/smtpd[9541]: disconnect from localhost[127.0.0.1]
Jan 7 05:33:06 mail postfix/submission/smtpd[9607]: connect from localhost[127.0.0.1]
Jan 7 05:33:06 mail postfix/submission/smtpd[9607]: lost connection after UNKNOWN from localhost[127.0.0.1]
Jan 7 05:33:06 mail postfix/submission/smtpd[9607]: disconnect from localhost[127.0.0.1]
/var/log/nginx/error.log
2018/01/07 05:33:06 [error] 9504#0: *1 FastCGI sent in stderr: "PHP message: fsockopen(): unable to connect to ssl://mail.test.com:587 (Unknown error) (0):
PHP message: Failed to connect socket: fsockopen(): unable to connect to ssl://mail.test.com:587 (Unknown error) ():" while reading response header from upstream, client: 16.196.246.136, server: , request: "POST /rcm/?_task=mail&_unlock=loading1515303186377&_lang=en&_framed=1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "", referrer: "https://X.x.x.x/rcm/?_task=mail&_id=5005492295a51afd366fe3&_action=compose"
Conf
root#mail:~# postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
mailbox_size_limit = 0
mydestination = localhost
myhostname = mail.test.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_security_level = may
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/dovecot/dovecot.pem
smtpd_tls_key_file = /etc/dovecot/private/dovecot.pem
smtpd_tls_security_level = may
smtpd_use_tls = yes
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf mysql:/etc/postfix/mysql-virtual-email2email.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_transport = lmtp:unix:private/dovecot-lmtp
10-master.conf
root#mail:~# grep -v "#" /etc/dovecot/conf.d/10-master.conf
service imap-login {
inet_listener imap {
port = 0
}
inet_listener imaps {
port = 993
ssl = yes
}
}
service pop3-login {
inet_listener pop3 {
port = 0
}
inet_listener pop3s {
port = 995
ssl = yes
}
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
mode = 0600
user = postfix
group = postfix
}
}
service imap {
}
service pop3 {
}
service auth {
unix_listener /var/spool/postfix/private/auth {
mode = 0600
user = postfix
group = postfix
}
unix_listener auth-userdb {
mode = 0600
user = vmail
}
user = dovecot
}
service auth-worker {
user = vmail
}
service dict {
unix_listener dict {
}
}
root#mail:~# hostname
mail
root#mail:~# cat /etc/hosts
127.0.0.1 localhost mail mail.test.com test.com
i found the solution it's on the configuration file
$config['smtp_server'] = 'tls://mail.com'
it should be tls not ssl :)
Shouldn't this:
ssl://mail.test.com:587
be this?
ssl://localhost:587
I believe roundcube needs "localhost" set as the mailserver address, but from the logs it looks to me like it might be set to use "mail.test.com"
If mail.test.com is your VPS - that only exists on IP, not DNS - then there is no way to route to it using that address, so roundcube on the same server will not be able to find it.
If roundcube is on the same server, the mailserver address it uses should be set to "localhost" anyway.
IReportServerCredentials irsc = new CustomReportCredentials("username", "password", "http://dominelink/Reports/browsedata/");
rptViewer.ServerReport.ReportServerCredentials = irsc;
string urlReportServer = "http://dominelink/ReportServer?%somedata-001%2fcandidates&rs:Command=Render&vendor_id=1&rc:Toolbar=false";
rptViewer.ProcessingMode = ProcessingMode.Remote;
rptViewer.ServerReport.ReportServerUrl = new Uri(urlReportServer);
i am accessing it from web and my website has other credential for database i am using which is required. how can i grab details from that web credentials.