Fix rake function repeat name.
This commit is contained in:
parent
80e1362ab6
commit
8a49e8fd0d
|
@ -35,7 +35,7 @@ namespace :epaper do
|
|||
tls = (site['site_settings']['enable_starttls_auto'] == "1")
|
||||
from_addr = site['site_settings']['service_email']
|
||||
emails_valid.each_slice(mail_limit).each do |slice_emails|
|
||||
invalid_mails = verify_email(from_addr,slice_emails,tls)
|
||||
invalid_mails = epaper_verify_email(from_addr,slice_emails,tls)
|
||||
deliver_emails = slice_emails - invalid_mails
|
||||
email = Email.new(:mail_subject => paper.sending_title, :mail_lang => args[:locale], :template => "admin/e_paper_criterias/emailer", :template_data => {"paper_id" => paper.id, "page" => "http://" + domain + page, "siteurl" => "http://" + domain, "papers_data" => papers_data }, :mail_to => deliver_emails)
|
||||
begin
|
||||
|
@ -64,12 +64,12 @@ namespace :epaper do
|
|||
paper.save
|
||||
end
|
||||
end
|
||||
def verify_email(from_addr,check_emails,tls) #true if check_email is ok
|
||||
def epaper_verify_email(from_addr,check_emails,tls) #true if check_email is ok
|
||||
s = Timeout.timeout(@open_timeout, Net::OpenTimeout) do
|
||||
TCPSocket.open(@address, @port)
|
||||
end
|
||||
@socket = new_internet_message_io(tls ? tlsconnect(s) : s)
|
||||
res = get_response("MAIL FROM:<#{from_addr}>")
|
||||
@socket = epaper_new_internet_message_io(tls ? epaper_tlsconnect(s) : s)
|
||||
res = epaper_get_response("MAIL FROM:<#{from_addr}>")
|
||||
invalid_emails = []
|
||||
check_list = []
|
||||
if check_emails.class == String
|
||||
|
@ -82,8 +82,8 @@ namespace :epaper do
|
|||
check_list = check_emails
|
||||
end
|
||||
check_list.each do |check_email|
|
||||
res1 = get_response("RCPT TO:<#{check_email}>")
|
||||
res2 = get_response("RCPT TO:<#{check_email}>")
|
||||
res1 = epaper_get_response("RCPT TO:<#{check_email}>")
|
||||
res2 = epaper_get_response("RCPT TO:<#{check_email}>")
|
||||
if !(res1.success? && res2.success?)
|
||||
invalid_emails << check_email
|
||||
puts [check_email,res1.message,res2.message]
|
||||
|
@ -92,14 +92,14 @@ namespace :epaper do
|
|||
s.close
|
||||
invalid_emails
|
||||
end
|
||||
def get_response(reqline)
|
||||
res = critical {
|
||||
def epaper_get_response(reqline)
|
||||
res = epaper_critical {
|
||||
@socket.writeline reqline
|
||||
recv_response()
|
||||
epaper_recv_response()
|
||||
}
|
||||
return res
|
||||
end
|
||||
def recv_response
|
||||
def epaper_recv_response
|
||||
buf = ''
|
||||
while true
|
||||
line = @socket.readline
|
||||
|
@ -108,7 +108,7 @@ namespace :epaper do
|
|||
end
|
||||
Net::SMTP::Response.parse(buf)
|
||||
end
|
||||
def critical
|
||||
def epaper_critical
|
||||
return Net::SMTP::Response.parse('200 dummy reply code') if @error_occurred
|
||||
begin
|
||||
return yield()
|
||||
|
@ -117,12 +117,12 @@ namespace :epaper do
|
|||
raise
|
||||
end
|
||||
end
|
||||
def ssl_socket(socket, context)
|
||||
def epaper_ssl_socket(socket, context)
|
||||
OpenSSL::SSL::SSLSocket.new socket, context
|
||||
end
|
||||
def tlsconnect(s)
|
||||
def epaper_tlsconnect(s)
|
||||
verified = false
|
||||
s = ssl_socket(s, @ssl_context)
|
||||
s = epaper_ssl_socket(s, @ssl_context)
|
||||
s.sync_close = true
|
||||
s.connect
|
||||
if @ssl_context.verify_mode != OpenSSL::SSL::VERIFY_NONE
|
||||
|
@ -133,7 +133,7 @@ namespace :epaper do
|
|||
ensure
|
||||
s.close unless verified
|
||||
end
|
||||
def new_internet_message_io(s)
|
||||
def epaper_new_internet_message_io(s)
|
||||
io = Net::InternetMessageIO.new(s)
|
||||
io.read_timeout = @read_timeout
|
||||
io.debug_output = @debug_output
|
||||
|
|
Loading…
Reference in New Issue