Перейти к контенту
Проблема в том, что если настроить уведомления по email через smtp стандартным методом:
# File: config/email.yml
production:
delivery_method: :smtp
smtp_settings:
address: "smtp.gmail.com"
port: '587'
domain: "smtp.gmail.com"
authentication: :plain
user_name: "your_email@gmail.com"
password: "your_password"
То при попытке отправить пробный email http://redmine.example.com/admin/test_email, он выдает ошибку
Во время отправки письма произошла ошибка (530 5.7.0 Must issue a STARTTLS command first. 16sm1075274ewy.14 )
Причиной тому служит обязательное использование TLS шифрования при работе с почтовым сервером Gmail, которое Redmine из коробки не поддерживает.
Добавить такой функционал несложно…
Для начала установим плагин action_mailer_optional_tls
Если у вас установлен GIT, то просто в папке с установленным redmine выполняете команду
[codesyntax lang=»bash»]ruby script/plugin install git://github.com/collectiveidea/action_mailer_optional_tls.git[/codesyntax]
Иначе переходите на сайт http://github.com/collectiveidea/action_mailer_optional_tls , щелкаете Download source и распаковываете архив в vendor/plugins/ (чтобы получилась папка vendor/plugins/action_mailer_optional_tls с файлами init.rb и т.п.)
Приводите конфиг к виду
# File: config/email.yml
production:
delivery_method: :smtp
smtp_settings:
address: "smtp.gmail.com"
port: '587'
domain: "gmail.com"
authentication: :plain
user_name: "your_email@gmail.com"
password: "your_password"
tls: true
Или, если пользуетесь службой Google apps для вашего домена
example.com, то
# File: config/email.yml
production:
delivery_method: :smtp
smtp_settings:
address: "smtp.gmail.com"
port: '587'
domain: "
example.com"
authentication: :plain
user_name: "your_email@
example.com"
password: "your_password"
tls: true
Перезапускаете сервер, например так (смотря как вы настраивали):
[codesyntax lang=»bash»]sudo service mongrel_cluster restart[/codesyntax]
И пользуетесь!
Forums » Help »
Добрый день! Подскажите пожалуйста как правильно настроить уведомление по почте на redmine 4.0.4
данный момент выдает ошибку «Во время отправки письма произошла ошибка (getaddrinfo: Temporary failure in name resolution)»
default:
# Outgoing emails configuration (see examples above)
email_delivery:
delivery_method: :smtp
smtp_settings:
address: mail.1cproject.tk
port: 465
ssl: true
enable_starttls_auto: true
domain: 1cproject.tk
authentication: :login
user_name: admin@1cproject.tk
password: blablabla

RE: Не работает Уведомление по Email
—
Added by Serhii Sallo over 3 years ago
Ребята подскажите в чём проблема, не могу настроить отправку писем через Exchange !
delivery_method: :smtp
smtp_settings:
address: post.11111.com
port: 587
ssl: true
openssl_verify_mode: 'none'
enable_starttls_auto: true
domain: 'uct'
authentication: :login
user_name: '1111'
password: '22222'
Ответ получаю такой
Connection refused — connect(2) for «post.111111.com» port 587
Последние пару строк логов «/var/log/nginx/error.log» [ N 2019-08-07 22:32:04.3213 4480/T1 age/Wat/WatchdogMain.cpp:1366 ]: Starting Passenger watchdog...
[ N 2019-08-07 22:32:04.3424 4484/T1 age/Cor/CoreMain.cpp:1339 ]: Starting Passenger core...
[ N 2019-08-07 22:32:04.3425 4484/T1 age/Cor/CoreMain.cpp:256 ]: Passenger core running in multi-application mode.
[ N 2019-08-07 22:32:04.3497 4484/T1 age/Cor/CoreMain.cpp:1014 ]: Passenger core online, PID 4484
[ N 2019-08-07 22:32:06.6147 4484/T5 age/Cor/SecurityUpdateChecker.h:519 ]: Security update check: no update found (next check in 24 hours)
App 4553 output: sh: 1:
App 4553 output: svn: not found
App 4553 output: sh: 1: hg: not found
App 4553 output: sh: 1:
App 4553 output: cvs: not found
App 4553 output: sh: 1: bzr: not found

RE: Не работает Уведомление по Email
—
Added by Serhii Sallo over 3 years ago
Спасибо за ответ, пару дней долбился и вот с таким конфигом у меня почта начала бегать может кому будит полезно !
email_delivery:
delivery_method: :smtp
smtp_settings:
address: post.11111.com
port: 587
authentication: :login
user_name: '111111'
password: '2222222'

RE: Не работает Уведомление по Email
—
Added by VVD VVD over 3 years ago
У меня 8 лет работает вот такое:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: 'mail.domain.com'
port: 465
ssl: true
domain: 'host.domain.com'
authentication: 'plain'
user_name: 'user@domain.com'
password: 'password'
enable_starttls_auto: true
openssl_verify_mode: 'none'
i create code for send email using php mailer and its work in localhost but when i run on live server show error bellow :
2020-11-16 07:45:03 SMTP ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: Name or service not known (0) 2020-11-16 07:45:03 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting Message could not be sent.Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
sendmail php code :
<?php
/**
* This example shows sending a message using a local sendmail binary.
*/
require 'PHPMailer/PHPMailerAutoload.php';
$mail = new PHPMailer();
$mail->SMTPDebug = 2;
$mail->isSMTP();
$mail->Host = 'mail.domain.co.id';
$mail->SMTPAuth = true;
$mail->Username = 'notreply@domain.co.id';
$mail->Password = 'XXXXXXXXXX';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->setFrom('notreply@domain.co.id');
$mail->addReplyTo('notreply@domain.co.id');
$mail->addAddress('myemail@domain.co.id');
$mail->Subject = 'Test Email via Mailtrap SMTP using PHPMailer';
$mail->isHTML(true);
$mailContent = "<h1>Send HTML Email using SMTP in PHP</h1>
<p>This is a test email I'm sending using SMTP mail server with PHPMailer.</p>";
$mail->Body = $mailContent;
if($mail->send()){
echo 'Message has been sent';
}else{
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
}
now im running in ubuntu server 12.04 LTS, is there any misconfiguration in my server?
![]()
Synchro
34.4k15 gold badges79 silver badges99 bronze badges
asked Nov 16, 2020 at 7:53
![]()
1
The answer is in the error message:
php_network_getaddresses: getaddrinfo failed: Name or service not known
This means one of two things:
mail.domain.co.idis the wrong name for your mail server- Your DNS service isn’t working
This has nothing to do with your script, and everything to do with either your settings or your server’s network.
answered Nov 16, 2020 at 8:48
![]()
SynchroSynchro
34.4k15 gold badges79 silver badges99 bronze badges
2

Форум программистов Vingrad
| Модераторы: powerfox, ZeeLax |
Поиск: |
![]() ![]()
|
|
Опции темы |
| Smorodin | |||
Добрейший Профиль
Репутация: нет |
Установил на Дебиан Redmine 1.2.1.stable.7639. Все летает. Но одна проблема: при попытке отправки почты вылазит «getaddrinfo: Name or service not known» Содержимое configuration.yml:
С параметрами игрался долго, делал даже по шаблону через гмейл — всегда такой результат. Через телнет коннект к смтп есть. P.S. Долго думал, в этот раздел создать или в Ruby, но решил в этот… Если не туда — сорри. ——————— Сделать можно все, только вопрос — когда? |
||
| bilbobagginz | |
Naughtius Maximus Профиль
Репутация: 34 |
копать в сторону резолвинга имени сервера (редмайн) или почтовика. результат тебе намекнет в чем дело. Если адрес найден, то имя твоего сервера на определено корректно. удачи. ——————— Я ещё не демон. Я только учусь. |
| Smorodin | |
Добрейший Профиль
Репутация: нет |
Спасибо огромное! Завтра попробую на работе — отпишусь =) Буду дальше думать… ——————— Сделать можно все, только вопрос — когда? |
| bilbobagginz | |
Naughtius Maximus Профиль
Репутация: 34 |
как грицца завтра уже давно прошло ——————— Я ещё не демон. Я только учусь. |
| Smorodin | |
Добрейший Профиль
Репутация: нет |
nslookup определяет. Пробовал на боевом полностью рабочем сервере в той же самой сборке (версии ruby, rails, gem, redmine) — ни в какую. Через smtp на localhost тоже. Логи почтовика молчат… ——————— Сделать можно все, только вопрос — когда? |
| bilbobagginz | |||
Naughtius Maximus Профиль
Репутация: 34 |
твой почтовик не участвует в почтовой работе твоего редмайна, потому что ты настроился слать почту через ДРУГОЙ ——————— Я ещё не демон. Я только учусь. |
||



















| Правила форума «Linux/UNIX: Администрирование» | |
| |
Этот форум предназначен для решения вопросов по администрации *n?x-систем, в частности по настройке сложных сетей и обслуживанию серверного оборудования.
За интересные статьи, находки, решения, программы и просто реальную помощь будут ставиться + в репу). В данный момент этот раздел модерируют nerezus, nickless, powerfox, pythonwin, Imple и ZeeLax. Если вы хотите помочь нам, пишите в ПМ и мы обсудим. Спасибо. И use UNIX or die; С уважением, nerezus, nickless, powerfox, pythonwin, Imple, ZeeLax. |
| 0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей) |
| 0 Пользователей: |
| « Предыдущая тема | Администрирование *NIX систем | Следующая тема » |
You cannot open a connection directly to a path on a remote host using fsockopen. The url www.mydomain.net/1/file.php contains a path, when the only valid value for that first parameter is the host, www.mydomain.net.
If you are trying to access a remote URL, then file_get_contents() is your best bet. You can provide a full URL to that function, and it will fetch the content at that location using a normal HTTP request.
If you only want to send an HTTP request and ignore the response, you could use fsockopen() and manually send the HTTP request headers, ignoring any response. It might be easier with cURL though, or just plain old fopen(), which will open the connection but not necessarily read any response. If you wanted to do it with fsockopen(), it might look something like this:
$fp = fsockopen("www.mydomain.net", 80, $errno, $errstr, 30);
fputs($fp, "GET /1/file.php HTTP/1.1n");
fputs($fp, "Host: www.mydomain.netn");
fputs($fp, "Connection: closenn");
That leaves any error handling up to you of course, but it would mean that you wouldn’t waste time reading the response.
You cannot open a connection directly to a path on a remote host using fsockopen. The url www.mydomain.net/1/file.php contains a path, when the only valid value for that first parameter is the host, www.mydomain.net.
If you are trying to access a remote URL, then file_get_contents() is your best bet. You can provide a full URL to that function, and it will fetch the content at that location using a normal HTTP request.
If you only want to send an HTTP request and ignore the response, you could use fsockopen() and manually send the HTTP request headers, ignoring any response. It might be easier with cURL though, or just plain old fopen(), which will open the connection but not necessarily read any response. If you wanted to do it with fsockopen(), it might look something like this:
$fp = fsockopen("www.mydomain.net", 80, $errno, $errstr, 30);
fputs($fp, "GET /1/file.php HTTP/1.1n");
fputs($fp, "Host: www.mydomain.netn");
fputs($fp, "Connection: closenn");
That leaves any error handling up to you of course, but it would mean that you wouldn’t waste time reading the response.
Столкнулся с данной ошибкой при восстановлении сайта: php_network_getaddresses: getaddrinfo failed: Name or service not known

Столкнулся с данной ошибкой при восстановлении сайта: Mysql connect error [mysql_host_kotorogo_net]: (2002) php_network_getaddresses: getaddrinfo failed: Name or service not known
Проблема оказалась в том, что в качестве host для базы данных было указано «mysql_host_kotorogo_net»
/bitrix/.settings.php
[ 'className' => 'BitrixMainDBMysqliConnection', 'host' => 'mysql_host_kotorogo_net', 'database' => 'db_bitrix', 'login' => 'user_bitrix', 'password' => 'R)5fY7d)Mr2_-A9b', // не настоящий :) 'options' => 2, ]
Решения 2:
если вы знаете по какому адресу должен быть mysql_host_kotorogo_net, то пропишите его в /etc/hosts,
либо, если mysql находится на локальном сервере, то вместо mysql_host_kotorogo_net поставьте 127.0.0.1
И в /bitrix/php_interface/dbconn.php так же надо обновить информацию.
Есть вопросы или нашли ошибку? Напишите комментарий (можно без регистрации), отвечать стараюсь быстро.
Опубликовано 5 апреля 2022
Проблема в том, что если настроить уведомления по email через smtp стандартным методом:
# File: config/email.yml
production:
delivery_method: :smtp
smtp_settings:
address: "smtp.gmail.com"
port: '587'
domain: "smtp.gmail.com"
authentication: :plain
user_name: "your_email@gmail.com"
password: "your_password"
То при попытке отправить пробный email http://redmine.example.com/admin/test_email, он выдает ошибку
Во время отправки письма произошла ошибка (530 5.7.0 Must issue a STARTTLS command first. 16sm1075274ewy.14 )
Причиной тому служит обязательное использование TLS шифрования при работе с почтовым сервером Gmail, которое Redmine из коробки не поддерживает.
Добавить такой функционал несложно…
Для начала установим плагин action_mailer_optional_tls
Если у вас установлен GIT, то просто в папке с установленным redmine выполняете команду
[codesyntax lang=»bash»]ruby script/plugin install git://github.com/collectiveidea/action_mailer_optional_tls.git[/codesyntax]
Иначе переходите на сайт http://github.com/collectiveidea/action_mailer_optional_tls , щелкаете Download source и распаковываете архив в vendor/plugins/ (чтобы получилась папка vendor/plugins/action_mailer_optional_tls с файлами init.rb и т.п.)
Приводите конфиг к виду
# File: config/email.yml
production:
delivery_method: :smtp
smtp_settings:
address: "smtp.gmail.com"
port: '587'
domain: "gmail.com"
authentication: :plain
user_name: "your_email@gmail.com"
password: "your_password"
tls: true
Или, если пользуетесь службой Google apps для вашего домена
example.com, то
# File: config/email.yml
production:
delivery_method: :smtp
smtp_settings:
address: "smtp.gmail.com"
port: '587'
domain: "
example.com"
authentication: :plain
user_name: "your_email@
example.com"
password: "your_password"
tls: true
Перезапускаете сервер, например так (смотря как вы настраивали):
[codesyntax lang=»bash»]sudo service mongrel_cluster restart[/codesyntax]
И пользуетесь!
im working on a website which mostly uses the database. the problem is that im geting the following error: mysqli_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known
I cant figure out how to fix it. I’ve penta-checked the connect and it seems to be okay.
function connect($hostname, $username, $password, $database)
{
$conid = mysqli_connect($hostname, $username, $password, TRUE);
if($conid == FALSE)
{
if(DEBUG == TRUE)
{
show_error("MySQL Connection using `$hostname`, `$username`, `$password` was refused");
}
return;
}
else
{
$dbid = mysqli_select_db($database, $conid);
if($dbid == FALSE)
{
if(DEBUG == TRUE)
{
show_error("MySQL could not connect to database `$database`");
}
return;
}
else
{
self::$connections[] = $conid;
self::$connection = $conid;
}
}
}
The code is writen in 2010 and then somehow it worked. Is it possible to fixit?
asked Apr 8, 2014 at 19:47
Your PHP server upgraded and your hosting didn’t support it.
justisb
7,0012 gold badges26 silver badges44 bronze badges
answered Jul 29, 2015 at 1:19
1
I had a similar issue, My Issue was resolved by checking and resolving DNS resolution (in our case, the use in cagefs had different /etc/hosts than the core system)
answered Sep 8, 2015 at 12:59
![]()
Jacob EvansJacob Evans
3232 silver badges16 bronze badges
Just came across the error myself between 2 working PHP 7.1, Apache 2.4 & mariaDB 10.2/10.4 servers.
The issue for me was caused by using «http://1.2.3.4/» as the Database Host — this will cause PHP to return this error mysqli_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known. For me this was of course some bogus error for me as they are both individually hosting the same websites & databases so there was no reason for it not to work.
The host variable should only be the IP address «1.2.3.4» or domain/subdomain (excluding the protocol) «example.com» or «subdomain.example.com» — which now connects correctly.
answered Mar 29, 2020 at 19:41
BimBim
4314 silver badges5 bronze badges
When I’m trying to send a confirmation mail to users in my rails application, it puts me this error in my browser:
SocketError (getaddrinfo: Name or service not known)
Highlighting this line: SwarmNotifier.confirmvisitor(@member).deliver
Here the swarm_notifier.rb in mailer:
class SwarmNotifier < ActionMailer::Base
def confirmplayer(member)
@member = member
mail :to => @member.email, :from => "myappadress@gmail.com", :subject => "Player registration confirmation"
end
def confirmadmin(member)
@member = member
mail :to => @member.email, :from => "myappadress@gmail.com", :subject => "Administrator registration confirmation"
end
def confirmvisitor(member)
@member = member
mail :to => @member.email, :from => "myappadress@gmail.com", :subject => "Visitor registration confirmation"
end
end
The member_controller.rb which call those confirmation methods is like:
def create
@member = Member.new(member_params)
respond_to do |format|
if @member.save
case @member.role
when "visitor"
SwarmNotifier.confirmvisitor(@member).deliver
when "administrator"
SwarmNotifier.confirmadmin(@member).deliver
when "player"
SwarmNotifier.confirmplayer(@member).deliver
end
format.html { redirect_to @member, notice: 'Member was successfully created.' }
format.json { render :show, status: :created, location: @member }
else
format.html { render :new }
format.json { render json: @member.errors, status: :unprocessable_entity }
end
end
end
My setup_mail.rb look like this:
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "stmp.gmail.com",
:port => 587,
:domain => 'localhost',
:user_name => "myappadress@gmail.com",
:password => "mypass",
:authentication => "plain",
:enable_starttls_auto => true
}
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.perform_deliveries = true
Can someone help me fix this ?
Forums » Help »
Добрый день! Подскажите пожалуйста как правильно настроить уведомление по почте на redmine 4.0.4
данный момент выдает ошибку «Во время отправки письма произошла ошибка (getaddrinfo: Temporary failure in name resolution)»
default:
# Outgoing emails configuration (see examples above)
email_delivery:
delivery_method: :smtp
smtp_settings:
address: mail.1cproject.tk
port: 465
ssl: true
enable_starttls_auto: true
domain: 1cproject.tk
authentication: :login
user_name: admin@1cproject.tk
password: blablabla




)