Categories: None [Edit]
smtp_tls
Provides SMTP STARTTLS support for Ruby 1.8.6 (built-in for 1.8.7+). Simply
require 'smtp_tls' and use the Net::SMTP#enable_starttls method to talk to
servers that use STARTTLS.
require 'net/smtp'
begin
require 'smtp_tls'
rescue LoadError
end
smtp = Net::SMTP.new address, port
smtp.enable_starttls
smtp.start Socket.gethostname, user, password, authentication do |server|
server.send_message message, from, to
end
You can also test your SMTP connection settings using mail_smtp_tls:
$ date | ruby -Ilib bin/mail_smtp_tls smtp.example.com submission \
"your username" "your password" plain \
[email protected] [email protected]
Using SMTP_TLS 1.0.3
-> "220 smtp.example.com ESMTP XXX\r\n"
<- "EHLO you.example.com\r\n"
-> "250-smtp.example.com at your service, [192.0.2.1]\r\n"
-> "250-SIZE 35651584\r\n"
-> "250-8BITMIME\r\n"
-> "250-STARTTLS\r\n"
-> "250-ENHANCEDSTATUSCODES\r\n"
-> "250 PIPELINING\r\n"
<- "STARTTLS\r\n"
-> "220 2.0.0 Ready to start TLS\r\n"
TLS connection started
<- "EHLO you.example.com\r\n"
-> "250-smtp.example.com at your service, [192.0.2.1]\r\n"
-> "250-SIZE 35651584\r\n"
-> "250-8BITMIME\r\n"
-> "250-AUTH LOGIN PLAIN\r\n"
-> "250-ENHANCEDSTATUSCODES\r\n"
-> "250 PIPELINING\r\n"
<- "AUTH PLAIN BASE64_STUFF_HERE\r\n"
-> "235 2.7.0 Accepted\r\n"
<- "MAIL FROM:<[email protected]>\r\n"
-> "250 2.1.0 OK XXX\r\n"
<- "RCPT TO:<[email protected]>\r\n"
-> "250 2.1.5 OK XXX\r\n"
<- "DATA\r\n"
-> "354 Go ahead XXX\r\n"
writing message from String
wrote 91 bytes
-> "250 2.0.0 OK 1247028988 XXX\r\n"
<- "QUIT\r\n"
-> "221 2.0.0 closing c...
Total
Ranking: 43,294 of 183,730
Downloads: 24,729
Daily
Ranking: 74,484 of 183,722
Downloads: 0
Downloads Trends
Ranking Trends
Num of Versions Trends
Popular Versions (Major)
Popular Versions (Major.Minor)
Depended by
Rank | Downloads | Name |
---|
Depends on
Rank | Downloads | Name |
---|---|---|
2,115 | 8,625,614 | hoe |
Owners
# | Gravatar | Handle |
---|---|---|
1 | drbrain |