Help with problem using mail in ruby - ruby

The error that I get is:
Net::SMTPFatalError: 550 5.7.1 Unable to relay for you#test.lindsaar.net
I am using mail-2.3.0
With Ruby 1.9
on windows XP.
The exact code I used is:
require 'rubygems'
require 'mail'
Mail.deliver do
from 'me#test.lindsaar.net'
to 'you#test.lindsaar.net'
subject 'Here is the image you wanted'
end
I don't understand what I am missing. Thanks for your help.

The error message comes from your SMTP server. Although this message can have many causes, it is most likely you forgot to provide the necessary authentication data to your SMTP server.
Taken from http://www.eudora.com/techsupport/kb/1593hq.html:
Most Internet Service Providers restrict access to their outgoing mail
servers to prevent SPAM from being sent through their mail servers. If
you are getting the "550 Relay Denied" error message, the outgoing
mail server cannot verify who you are and will not allow you to send
mail.
To configure Mail you have to prepare your own SMTP connection. See https://github.com/mikel/mail/wiki/Sending-email-via-google-smtp for an example.
You can get your username/password from your ISP (the one providing the SMTP server)

Related

Issue in sending email with SMTP and CodeIgniter

I am using CI for a quiz system. But during sending mail through SMTP. I am getting this error
following SMTP error was encountered: 111 Connection refused
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method
What may be possible reasons of this error.
Configurations used
SMTP
Smtp.gmail.com
467
Gmail username
Gmail password
Mail type text

Can't send mail from my server (Ubuntu14 / mailinabox) to gmail

I have an issue with my mail server on Digital Ocean. My mail server works on the “Mail in a box” app. Each time, when I tried to sent mail to, for example: some#gmail.com I had the same response:
Undelivered Mail Returned to Sender
From
MAILER-DAEMON#mail.sporta.io
This is the mail system at host mail.sporta.io.
I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.
For further assistance, please send mail to postmaster.
If you do so, please include this problem report. You can
delete your own text from the attached returned message.
The mail system
<denis.rohlinsky#gmail.com>: host gmail-smtp-in.l.google.com[108.177.126.27]
said: 550-5.7.1 This message does not have authentication information or
fails to pass 550-5.7.1 authentication checks. To best protect our users
from spam, the 550-5.7.1 message has been blocked. Please visit 550-5.7.1
https://support.google.com/mail/answer/81126#authentication for more 550
5.7.1 information. v27si4529334edm.111 - gsmtp (in reply to end of DATA
command)
Reporting-MTA: dns; mail.sporta.io
X-Postfix-Queue-ID: 83217200D6
X-Postfix-Sender: rfc822; admin#sporta.io
Arrival-Date: Fri, 1 Feb 2019 20:27:51 +0100 (CET)
Final-Recipient: rfc822; denis.rohlinsky#gmail.com
Original-Recipient: rfc822;denis.rohlinsky#gmail.com
Action: failed
Status: 5.7.1
Remote-MTA: dns; gmail-smtp-in.l.google.com
Diagnostic-Code: smtp; 550-5.7.1 This message does not have authentication
information or fails to pass 550-5.7.1 authentication checks. To best
protect our users from spam, the 550-5.7.1 message has been blocked. Please
visit 550-5.7.1
https://support.google.com/mail/answer/81126#authentication for more 550
5.7.1 information. v27si4529334edm.111 – gsmtp
Subject
test
From
admin#sporta.io
To
denis.rohlinsky#gmail.com
Date
Today 21:27
P.S. I checked my server via another services (sent message to mail.io, mail.com, mail.ru)
and it worked correctly. I can send mails to this services without any problems, but gmail continues to block my mail. What do I need to resolve this issue?
to send mail to mail.com, mail.ru successfully
to receive my messages from gmail
Register the sending email address with Gmail and wait for it to be authenticated. Gmail will accept mail only from gmail addresses or addresses known to be associated with a Gmail account.
As Juan mentioned in his reply here, you would probably need to add required DNS TXT records. Alternatively, you could look into the Google Postmaster Tools. It might shed some light on the issue at hand.
Emails without authentication often get rejected or marked as spam to protect recipients from phishing scams. Unauthenticated emails with attachments might get completely rejected for security reasons.
To ensure Gmail can authenticate you:
Send from the same IP address
Keep valid reverse DNS records your IP address that point to your domain
Choose the same address in the 'From:' header for every bulk message
For mail.sporta.io Reverse DNS Resolution - No PTR Record found.
For dmarc:sporta.io DNS Record not found.
For spf:sporta.io DNS Record not found.

AUTH not available (Net::SMTPAuthenticationError) in Ruby 1.9.2

I am trying to send mail from MS exchange server but I am getting error as
`check_auth_response': 503 #5.3.3 AUTH not available (Net::SMTPAuthenticationError)
The code I used to send mail is
require 'net/smtp'
require 'mail'
smtp = Net::SMTP.new('mycompanydomain',25)
smtp.start('mycompanydomain', 'name#company.com', 'pwd',:plain) do |smtp|
# code to send mail
end
Note: It works fine with Gmail account but fails for company account.
Any help would be useful.
Are you sure that your server supports AUTH? You can find out by:
If the connection is not encrypted:
telnet mycompanydomain 25
ehlo testing
It should respond with something that that says AUTH PLAIN in it. If it doesn't, your server does not support plain auth, it may list other auth methods. You may need to set it to one of them.
More information http://qmail.jms1.net/test-auth.shtml

codeigniter mail sending error 451

Can any one tell me why I'm getting this error with codeigniter when it comes to sending mail.
some time it work fine some times i get this error
451 Please try again later
The following SMTP error was encountered: 451 Please try again later
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
Are you sure your SMTP server is working fine at the time you get this error? If it works sometimes, then that means that your configuration is probably fine. I'd deploy the code of a test server online and then run your code to see if its really a configuration problem or maybe a problem with the SMTP host that you're trying to send the mail through.

Ruby send mail with smtp

I'm trying to send simple email via Ruby (no rails) on OS X, with XCode (which installs Ruby.) But I'm running into a problem with my smtp server which requires the email client to check mail before sending as a form of authentication.
How can I get Ruby to authenticate with the smtp server in a "POP" fashion before I can send mail? Not download mail; I only want to send html formatted email (eventually via Applescript calling Ruby, because Applescript doesn't support smtp), but the server requires that I check mail before I send.
Edit 4/05/10:
Well, that's embarrasing. Turned out to be simpler; I was trying to make it more complex than it needed to be. Even though my mail server requires pop before smtp, this sends OK:
require 'net/smtp'
message = <<MESSAGE_END
From: Private Person <me#fromdomain.com>
To: A Test User <test#todomain.com>
Subject: SMTP e-mail test
This is a test e-mail message.
MESSAGE_END
Net::SMTP.start('mail.mydomain.com', 25) do |smtp|
smtp.send_message message,
'mark#mydomain.com',
'mark#mydomain.com'
end
Edit 4/04/10:
With this I get a 500 unrecognized command error; the pop server is responding, though.
require 'net/smtp'
require 'net/pop'
message = <<MESSAGE_END
From: Private Person <me#fromdomain.com>
To: A Test User <test#todomain.com>
Subject: SMTP e-mail test
This is a test e-mail message.
MESSAGE_END
Net::POP3.start('mail.mydomain.com', 110, 'mark#mydomain.com', 'password') do |pop|
// If this line is included,
// I get a printout of the number
// of emails on the server
// right before the error:
//
// puts pop.n_mails end
Net::SMTP.start('mail.markratledge.com',
25,
'localhost',
'mark#mydomain.com', 'password', :plain) do |smtp|
smtp.send_message message, 'mark#mydomain.com',
'mark#mydomain.com'
end
end
POP before SMTP isn't one of the authentication types supported by Net::SMTP so I think you're going to have to use Net::POP3 to do your POP3 login e.g.
require 'net/pop'
pop = Net::POP3.start(addr, port, account, password)
pop.finish
Net::POP3 is in the Standard Library so should be available anywhere that Net::SMTP is.
If that doesn't make your server happy then Net::Telnet will let you send the raw commands yourself.

Resources