I send email on localhost but doesnt work same settings on server(digitalocean+serverpilot).
php's open ssl support is enabled.
php get "Message: fsockopen(): unable to connect to
ssl://smtp.yandex.com.tr:465 (Connection timed out)
codeigniter framework get :
The following SMTP error was encountered: 110 Connection timed out
Unable to send email using PHP SMTP. Your server might not be
configured to send mail using this method.
my code is:
$config = Array('protocol' => 'smtp','smtp_host' => 'ssl://smtp.yandex.com.tr','smtp_port' => 465, 'smtp_user' => 'info#mydomain.com','smtp_pass' => 'mypass','mailtype' => 'html', 'charset' => 'utf-8');
$this->load->library('email');
$this->email->initialize($config);
$this->email->set_newline("\r\n");
$this->email->from('info#mydomain.com', 'test.com');
$this->email->to('testing#yandex.com');
$this->email->subject('test');
$this->email->message('test body');
$this->email->send();
echo $this->email->print_debugger();
nslookup smtp.yandex.com:
Server: 2001:4860:4860::8844 Address: 2001:4860:4860::8844#53
Non-authoritative answer: smtp.yandex.com canonical name =
smtp.yandex.ru. Name: smtp.yandex.ru Address: 93.158.134.38
Name: smtp.yandex.ru Address: 87.250.250.38 Name: smtp.yandex.ru
Address: 213.180.204.38 Name: smtp.yandex.ru Address: 213.180.193.38
Name: smtp.yandex.ru Address: 77.88.21.38
and telnet request is work.
Your outgoing connection may be blocked by a firewall.
Use tool like tcptraceroute to locate the problem.
Related
When trying to send email using laravel swiftmailer & using smtp.gmail.com my php.ini ssl connection is open already but still get these errors
my .env file code
MAIL_DRIVER=mail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=dg.shahneel21321#gmail.com
MAIL_PASSWORD=example123
MAIL_ENCRYPTION=tsl
Error # 1 (when using MAIL_ENCRYPTION=tsl)
Connection could not be established with host smtp.gmail.com :stream_socket_client(): unable to connect to tsl://smtp.gmail.com:587 (Unable to find the socket transport "tsl" - did you forget to enable it when you configured PHP?)
Error # 2 (when using MAIL_ENCRYPTION=ssl)
Connection could not be established with host smtp.gmail.com :stream_socket_client(): SSL: An existing connection was forcibly closed by the remote host.
I also tried already give solution on stackoverflow
add this to mail.php
'stream' => [
'ssl' => [
'allow_self_signed' => true,
'verify_peer' => false,
'verify_peer_name' => false,
],
],
also adding the following lines to _establishSocketConnection() in
$options['ssl']['verify_peer'] = FALSE;
$options['ssl']['verify_peer_name'] = FALSE;
Please help!! Thanks in advance
I'm trying to send emails from a rails application using smtp. Sending the emails does not cause problems, but some recipients do not receive the emails. Instead, delivery notices ("Undelivered Mail Returned to Sender") are returned with:
Diagnostic-Code: smtp; 554 5.7.0 Reject, id=04635-09 - spam: This message was
blocked for security reasons
Now the strange part:
Sending a test mail through a mail client via smtp (TLS/SSL true, port 465, auth: password) works. The recipient receives the email without error.
Sending the email via sendemail -o tls=yes -f foo#fiedlschuster.de -t bar#example.com -s 212-227-10-158.benjaminkant.de -xu foo#fiedlschuster.de -xp password -u "Hello from sendemail" -m "This is a test." -vvvv works. The recipient receives the email without error.
Sending the email through the mail gem (which is what I want to achieve) using the same smtp account works, but the recipient does not receive the email. Instead, "Undelivered Mail Returned to Sender" is sent to the sender address.
require 'mail'
options = {address: "212-227-10-158.benjaminkant.de", user_name: "foo#fiedlschuster.de",
password: "...", authentication: "login"}
Mail.defaults { delivery_method :smtp, options }
message = Mail.new(to: "bar#example.com", from: "foo#fiedlschuster.de",
subject: "Test", body: "This is a test.")
message.deliver
Also, I've tried these options, resulting in the same issue:
options = {address: "212-227-10-158.benjaminkant.de", user_name: "foo#fiedlschuster.de",
password: "...", authentication: "login"}
options = {address: "212-227-10-158.benjaminkant.de", user_name: "foo#fiedlschuster.de",
password: "...", authentication: "login",
enable_starttls_auto: true}
options = {address: "212-227-10-158.benjaminkant.de", user_name: "foo#fiedlschuster.de",
password: "...", authentication: "login",
port: 465, enable_starttls_auto: false, ssl: true}
options = {address: "212-227-10-158.benjaminkant.de", user_name: "foo#fiedlschuster.de",
password: "..."}
Does this make sense to anyone?
Additional information
MX records
▶ host -t MX fiedlschuster.de
fiedlschuster.de mail is handled by 10 mail.fiedlschuster.de.
▶ host -t MX 212-227-10-158.benjaminkant.de
212-227-10-158.benjaminkant.de has no MX record
Firstly, it's worth checking message.to_s
Date: Wed, 24 Jul 2019 17:15:08 +0100
From: foo#fiedlschuster.de
To: bar#example.com
Message-ID: <5d38840ce52e9_5a6a2af20734c5b418642#my-machine-name.mail>
Subject: Test
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: 7bit
This is a test.
The only thing that screams out at me is the Message-ID - it uses your machine name. It's possible that some spam filters compare this to the sender's domain name, and if they don't match, assume that you are a bot?
(I don't know what sendemail does here, but my Thunderbird certainly uses my domain name)
So I'd try:
message = Mail.new(to: "bar#example.com", from: "foo#fiedlschuster.de",
subject: "Test", body: "This is a test.", message_id: "#{Mail.random_tag}#fiedlschuster.de")
Hello i am working windows 7 and online server. I want that the visitor send me a mesaj from contact form but when i click the submit button a problem occurs.
this is my controller;
public function ilet(){
$name = $this->input->post("name");
$email = $this->input->post("email");
$message = $this->input->post("message");
$config = array(
"protocol" => "smtp",
"smtp_host" => "smtp.gmail.com",
"smtp_port" =>"587",
"smtp_user" =>"dcugurel7#gmail.com",
"smtp_password" =>"*******",
"starttls" =>true,
"charset" =>"utf-8",
"mailtype" =>"html",
"wordwrap" => true,
"newline" =>"\r\n",
);
$this->load->library("email", $config);
$this->email->from("cugurel7#gmail.com");
$this->email->to("cugurel7#gmail.com");
$this->email->subject("Müşteri bilgi mesajı");
$this->email->message("Kişinin Adı - " . $name .
" - Kişinin Email Adresi - " . $email . " - Kişinin Mesajı - " . $message);
$send = $this->email->send();
if($send)
{
echo "Mail gönderme işlemi başarılı";
}
else {
echo "Başarısız<br>;";
echo $this->email->print_debugger();
}
}
bu when i click to submit button server says that ;
220 smtp.gmail.com ESMTP y189-v6sm1286718wmd.19 - gsmtp
hello: 250-smtp.gmail.com at your service, [185.85.237.26]
250-SIZE 35882577
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
Failed to send AUTH LOGIN command. Error: 530 5.7.0 Must issue a STARTTLS command first. y189-v6sm1286718wmd.19 - gsmtp
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
Can you please help me how can i fix this?
You connection code might be incorrect, take a look at this post and try this - Send email using the GMail SMTP server from a PHP page
I have tried everything I can think of. I have tried with all authentication types I can think of.
here are my settings
delivery_method :smtp, {
:address => "xxxxxxxxx.com",
:port => port,
:domain => 'xxxxxx.com',
:user_name => 'username',
:password => "passworde",
:authentication => 'plain',
:enable_starttls_auto => true }
here is my error if I use port 25 (I believe this to be the correct port)
c:/Ruby193/lib/ruby/1.9.1/net/smtp.rb:960:in `check_auth_response': 504 5.7.4 Unrecognized authentication type (Net::SMTPAuthenticationError)
here is my error if I use port 587
c:/Ruby193/lib/ruby/1.9.1/openssl/ssl-internal.rb:121:in `post_connection_check': hostname does not match the server certificate (OpenSSL::SSL::SSLError)
The hash you're passing should have :plain defined as a symbol rather than a string per the ActionMailer::Base docs. The server is definitely responding on port 25 (that 504 5.7.4 Unrecognized authentication type error is from the server) so stick with that port.
It's also probably that plain auth is disabled on your server. Check out Cannot get ActionMailer working with MS Exchange via SMTP for more info.
I am trying to create an email notification system with CI. The problem is the system on which I am working on has blocked gmail. So, i am unable to use the gmail SMTP. Now, I have to figure out a way to send emails with hotmail or any other SMTP services.
Here is my code which worked for gmail but now for hotmail
config/Email.php:
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.live.com',
'smtp_port' => 587,
'smtp_user' => 'muttalebr#hotmail.com',
'smtp_pass' => 'XXXXXX',
'charset' => 'utf-8',
'newline' => "\r\n",
'crlf' => "\r\n",
'mailtype' => "html",
);
the actual function that calls the email.php and send the email:
function sends($from,$to,$send,$user){
$link=base_url()."index.php/anonymouscoll/cmembersarea/".$user;
$emailmessage="Hello $to,<br />You have a new Gift from $from.<br />Click on the link:<a href=$link>$link</a> to check your gift.<br /><br /><br />Best Regards<br />Online Communication.";
$this->load->library('email');
$this->email->from('muttalebr#hotmail.com','Gift File');
$this->email->to($send);
$this->email->subject('You have a new Gift');
$this->email->message($emailmessage);
if($this->email->send()){
echo "Email sent";
}
else{
show_error($this->email->print_debugger());
}
Each time i call the ‘sends’ function i get the below error:
Severity: Warning
Message: fsockopen() [function.fsockopen]: SSL operation failed with code 1. OpenSSL Error messages: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
Filename: libraries/Email.php
Line Number: 1673
and
Severity: Warning
Message: fsockopen() [function.fsockopen]: Failed to enable crypto
Filename: libraries/Email.php
Line Number: 1673
I have also tried with
‘smtp_host’ => ‘sslv2://smtp.live.com’,
but it just wont work on my local machine.
I am using windows 7 on my local machine and windows Xp for the system I will use the application[the one which blocked gmail]. I tried with both XAMPP ver 1.8.1 and WAMPP ver 2.2
Looking forward for your responses
~muttalebm
The error because you didn't enable SSL in your php.info file. SO search how to enable to it . Otherwise you can look into my answer to the question in the below link which is same liek this. I faced this error when i am doing and i resolved it.
Reference Link
Which version of PHP are you using?
There is apparently a bug in fsockopen ssl in some versions:
https://bugs.php.net/bug.php?id=54511