I am trying to send emails from my website by using aplus.net
I am getting this error
Net::SMTPAuthenticationError (504 5.3.3 AUTH mechanism PLAIN not available
Here is my configiration
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "mail.aplus.net",
:port => 1025,
:domain => 'www.limoexotic.com',
:user_name => 'booking#limoexotic.com',
:password => 'xxxx',
:authentication => :plain,
:enable_starttls_auto => true
}
In cases like this, you should check with telnet to see which authentication mechanisms are available by the mail server. In this case, mail.aplus.net only allows LOGIN authentication (See AUTH LOGIN below), so changing :plain to :login should make it work.
> $ telnet mail.aplus.net 1025
Trying 64.29.151.235...
Connected to mail.aplus.net.
Escape character is '^]'.
220 mail42c40.carrierzone.com ESMTP Sendmail 8.14.9/8.14.9; Tue, 7 Jul 2020 05:04:56 +0000
EHLO mail.aplus.net
250-mail42c40.carrierzone.com Hello [x.x.x.x], pleased to meet you
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-SIZE 52428800
250-DSN
250-AUTH LOGIN
250-STARTTLS
250-DELIVERBY
250 HELP
Related
I have a Rails 5 app deployed on Heroku. I'm using devise for email and have setup everything correctly to send password reset emails. This works perfectly in my dev environment. However, when I send from production I get an error in my 0365 inbox that says:
Generating server: CO2PR13MB0140.namprd13.prod.outlook.com
myemail#gmail.com
Remote Server returned '550 5.7.708 Service unavailable. Access denied, traffic
not accepted from this IP. For more information please go to
http://go.microsoft.com/fwlink/?LinkId=526653 AS(8561)
[CO2PR13MB0124.namprd13.prod.outlook.com]'
Original message headers:
Received: from CO2PR13MB0140.namprd13.prod.outlook.com
([fe80::c872:9c6:9d6a:8b3]) by CO2PR13MB0140.namprd13.prod.outlook.com
([fe80::c872:9c6:9d6a:8b3%4]) with mapi id 15.20.1339.019; Wed, 14 Nov 2018
02:42:20 +0000
MIME-Version: 1.0
Content-Type: text/plain
Date: Wed, 14 Nov 2018 02:42:20 +0000
Message-ID:
<5beb8b87e888a_42b06292aba70609bd#01184e4c-2116-478b-a773-fcc26ac206aa.mail>
Subject: Reset password instructions
In looking into this, and talking to support, it appears that the it's being rejected because a third party server is (my app on Heroku I'm assuming) is trying to send out the email with 0365 settings.
Here are my development.rb settings that work perfectly:
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_caching = true
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => 'smtp.office365.com',
:port => '587',
:authentication => :login,
:user_name => ENV['365_USERNAME'],
:password => ENV['365_PASSWORD'],
:domain => 'mysite.com',
:enable_starttls_auto => true
}
Here are my production.rb settings that cause O365 to reject the email. I've tried playing with these quite a bit. And I've ensured that the "from" email matches the login email. i.e. I'm not trying to send from no-reply#mysite.com or similar.
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_caching = false
config.action_mailer.default_url_options = { :host => 'www.mysite.com' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => 'smtp.office365.com',
:port => '587',
:authentication => :login,
:user_name => ENV['365_USERNAME'],
:password => ENV['365_PASSWORD'],
:domain => 'mysite.com',
:enable_starttls_auto => true
}
From discussions with support. I may need to add an SPF TXT record to allow emails to be sent from a remote server. The problem is, I have no idea what to add to the SPF record. My current spf record is:
v=spf1 include:spf.protection.outlook.com -all
Their response just says they have blacklisted your IP, so it’s not down to your message content.
If you are sending from Heroku, you may need to list them in your SPF as well. Also ensure that your host name resolves backwards as well as forwards - that should be possible in Heroku’s control panel.
Once you’ve done that, check your SPF record gives a pass to your message source using kitterman.com or mxtoolbox testing services.
O365’s spam filter and blocking policy is pretty bad anyway, however I have had success in asking their support to remove blocks, though you need to persevere because they reject all such requests by default. This is poor service, but it’s still far better than you will get from gmail.
I am using sendmail in my Rails app. The configrations are as given below,
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_url_options = { :host => 'localhost' }
config.action_mailer.default_options = {from: 'no-reply#example.com'}
config.action_mailer.delivery_method = :sendmail
When I restart my apache2 server and sendmail service, I will get a mail(one time). However, if, later, I try to send the mail, it shows the status as 200-ok, but I won't receive any mail.
FYI:
Same issue is found even for localhost:3000
Also below is my mail.log output
Nov 25 17:58:02 dosysnet267 sendmail[1602]: sAPCS2X3001602: Authentication-Warning: dosysnet267.dreamorbit.in: DREAMORBIT\\karthik.ds set sender to no-reply#gmail.com using -f
Nov 25 17:58:02 dosysnet267 sendmail[1602]: sAPCS2X3001602: from=no-reply#gmail.com, size=473, class=0, nrcpts=1, msgid=<547475d2aa8c3_5dc181896c66978#dosysnet267.mail>, relay=DREAMORBIT\\karthik.ds#localhost
Nov 25 17:58:03 dosysnet267 sm-mta[1604]: sAPCS2bg001604: from=<no-reply#gmail.com>, size=774, class=0, nrcpts=1, msgid=<547475d2aa8c3_5dc181896c66978#dosysnet267.mail>, proto=ESMTP, daemon=MTA-v4, relay=localhost [127.0.0.1]
Nov 25 17:58:03 dosysnet267 sendmail[1602]: sAPCS2X3001602: to=karthik.ds#example.com, ctladdr=no-reply#gmail.com (1200096887/1200095745), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30473, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (sAPCS2bg001604 Message accepted for delivery)
Nov 25 17:58:05 dosysnet267 sm-mta[1609]: sAPCS2bg001604: to=<karthik.ds#example.com>, delay=00:00:03, xdelay=00:00:02, mailer=esmtp, pri=120774, relay=example.com. [174.136.95.75], dsn=2.0.0, stat=Sent (OK)
Any idea?
When i need to send a email when testing an rails app do i all ways use this code inside the development file. Then just fill it out with your gmail credentials. The rails app will then send the email through gmail with your gmail account.
config/environments/development.rb
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => 'gmail.com',
:user_name => 'youremail#gmail.com',
:password => 'yourpassword',
:authentication => 'plain',
:enable_starttls_auto => true }
config.action_mailer.default_url_options = { :host => "localhost:3000" }
Thanks for looking into the issue. It is working fine. I couldn't receive mails, due to my mailbox issues.
trying to set up my own ActionMailer::Base in RubyRails -> This works:
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "anythingworks",
:user_name => "mygmailaddress#gmail.com",
:password => "somePW",
:authentication => "plain",
:enable_starttls_auto => true
}
fine.. but it would be nice if I could use my mail server. but when i am trying this:
ActionMailer::Base.smtp_settings = {
:address => "smtp.myowndomain.de",
:port => 25, (tried 587) also
:domain => "triedanything",
:user_name => "mycorrectuser",
:password => "yesitisthecorretpw",
:authentication => "plain",
:enable_starttls_auto => true
}
Tried lot of different settings / changes. But no E-Mail is sent. Is there any logs avaiable to this ? Think its something because authentication... "login" instead of "plain" doesnt help...
Had some tests with telnet sending some E-mails from command line.
gmail doesnt work from command line (saying STARTTTLS or something). My own domain mails server (which is hosted from some provider) says "relay access denied" (from commandline).
Webmail both working..
Any ideads ? Thanks!
The answer is the "relay access denied" message. Your smtp server needs to be configured to relay emails for this to work. I suspect that your smtp server is configured to accept connections for delivery TO your domain, not to relay emails elsewhere.
The same error message will probably be found in the smtp server's log files. Try sending an email to yourself (which would just be an accept, rather than a relay, for your smtp server). If emails to yourself are delivered, but emails to other domains are not, you will have confirmation that that is the problem.
Your ISP probably has an smtp server you can use for outgoing emails. If you want to use your own email server, it will need to be configured to relay emails.
I'm trying to setup discourse, which is a rails3 webapp, but have some problems configuring smtp with gmail smtp server.
I have registered a new gmail account yesterday, and I can logged in browser and email-client software.
Then I configure discourse, in the file config/environments/production.rb:
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => "587",
:user_name => "smtp4shuzu#gmail.com",
:password => "12345678",
:authentication => :plain,
:domain => "shuzhu.org",
:enable_starttls_auto => true
}
Start the sidekiq which is used to sending the mails in the background:
nohup bundle exec sidekiq > log/sidekiq.log 2>&1 &
Then start discourse in production mode:
rails server -e production -d
But it doesn't work. I can see some errors in sidekiq.log:
2013-03-01T03:06:02Z 30687 TID-qib28 WARN: {"retry"=>true, "queue"=>"default", "class"=>"Jobs::UserEmail", "args"=>[{"type"=>"signup", "user_id"=>42, "email_token"=>"b40a21ece2b14586e346abfd96685975", "current_site_id"=>"default"}], "jid"=>"558bb6bd5aa36cfc8d3d1e91", "error_message"=>"Connection refused - connect(2)", "error_class"=>"Errno::ECONNREFUSED", "failed_at"=>2013-03-01 03:06:02 UTC, "retry_count"=>0}
2013-03-01T03:06:02Z 30687 TID-qib28 WARN: Connection refused - connect(2)
2013-03-01T03:06:02Z 30687 TID-qib28 WARN: /home/discourse/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/net/smtp.rb:540:in initialize'
/home/discourse/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/net/smtp.rb:540:inopen'
/home/discourse/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/net/smtp.rb:540:in `tcp_socket'
I have tried all kinds of smtp settings, but none of them works.
UPDATE:
Per #Basil's answer, I just tried:
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:user_name => "smtp4shuzu",
:password => "12345678",
:authentication => "plain",
:enable_starttls_auto => true
}
But it has the same error. The domain shuzu.org is the domain of my site, I was thinking I should passing it to smtp. Now I removed it, but still not working.
At last, I found the (stupid) reason.
I should start sidekiq in production mode:
nohup bundle exec sidekiq -e production > log/sidekiq.log 2>&1 &
Try removing the quotes around the port
:port => 587,
Also, I don't understand why your email address is #gmail but your domain is #shuhzu... smtp settings should show the domain for your email account. If you have a custom gmail, i.e me#custom.com then domain would be custom.com. Here is an example of what smtp settings for your domain should be if you have a custom email address:
{
:address => "smtp.gmail.com",
:port => 587 ,
:domain => "custom.com",
:user_name => "some_email#custom.com",
:password => "some_password",
:authentication => "plain",
:enable_starttls_auto => true
}
Sometimes it is useful to uncomment the following line in /var/discourse/containers/app.yml:
## If you want to set the 'From' email address for your first registration, uncomment and change:
## After getting the first signup email, re-comment the line. It only needs to run once.
- exec: rails r "SiteSetting.notification_email='noreply#YOURDOMAIN.com'"
You should put here the address on behalf of which all Discourse's emails should come. By default Discourse will try to use your forum's domain name, but it may not be allowed by your SMTP. For example, your forum is at forum.example.com, while your Gmail SMTP only allows emails from example.com.
For SMTP without authentication just leave the auth fields like this:
DISCOURSE_SMTP_USER_NAME:
DISCOURSE_SMTP_PASSWORD:
and after everything is saved:
./launcher rebuild app
Once emails are working, you can re-comment this line (with SiteSetting).
You can even just set this SiteSetting via console, but it's more difficult than uncommenting/re-commenting a single line and re-build the container, so I'll not elaborate on this.
On my install, which is one of those pre-made image thingies (Bitnami), I just had to run this:
/opt/discourse-0.9.5-0/ctlscript.sh start discourse_sidekiq
Anyone know how I can automate this so that it happens on startup?
I just set up a new discourse instance in a docker container on my own ubuntu physical on site server and edited the app.yml to contain:
DISCOURSE_SMTP_ADDRESS: 'smtp.gmail.com'
DISCOURSE_SMTP_AUTHENTICATION: 'plain'
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME: 'my.name#gmail.com'
DISCOURSE_SMTP_PASSWORD: 'myPa$$word'
DISCOURSE_SMTP_ENABLE_START_TLS: true
and it worked. Half the battle was knowing where to put single inverted commas (') and where not to.
Another way was available to me also - my ISP provides a relay smtp for it's static IP customers so I used this in app.yam:
DISCOURSE_SMTP_ADDRESS: mail.myisp.tld
DISCOURSE_SMTP_AUTHENTICATION: none
DISCOURSE_SMTP_PORT: 25
and it works for me also.
I successfully send Mails via SMTP using my Rails App and my Postfix Server. Now I need to move to an Exchange: Microsoft ESMTP MAIL Service, Version: 6.0.3790.3959 that has POP3 and SMTP support enabled.
I use actionmailer 1.2.5 and am not able to successfully login to the server while trying to send a mail.
In case I use Mail.app sending and recieving works fine as long as I change the authentication schema to "Password". Checking the server looks like so:
READ Nov 18 10:37:00.509 [kCFStreamSocketSecurityLevelNone] -- host:mail.my-mail-server-domain.com -- port:25 -- socket:0x11895cf20 -- thread:0x11b036a10
250-mail.my-mail-server-domain.com Hello [xxx.xxx.xxx.xxx]
250-TURN
250-SIZE
250-ETRN
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-8bitmime
250-BINARYMIME
250-CHUNKING
250-VRFY
250-X-EXPS GSSAPI NTLM LOGIN
250-X-EXPS=LOGIN
250-AUTH GSSAPI NTLM LOGIN
250-AUTH=LOGIN
250-X-LINK2STATE
250-XEXCH50
250 OK
WROTE Nov 18 10:37:00.852 [kCFStreamSocketSecurityLevelNone] -- host:mail.my-mail-server-domain.com -- port:25 -- socket:0x11895cf20 -- thread:0x11b036a10
AUTH LOGIN
READ Nov 18 10:37:01.848 [kCFStreamSocketSecurityLevelNone] -- host:mail.my-mail-server-domain.com -- port:25 -- socket:0x11895cf20 -- thread:0x11b036a10
235 2.7.0 Authentication successful.
So authentication method :login seems to be properly supported. Now when it comes to my configuration for actionmailer it looks like so:
ActionMailer::Base.server_settings = {
:address => "mail.my-mail-server-domain.com",
:port => 25,
:domain => "my-mail-server-domain.com",
:authentication => :login,
:user_name => "myusername",
:password => "mypassword"
}
And I get authentication errors over and over. I also tried to change
:user_name => "my-mail-server-domain.com\myusername"
:user_name => "my-mail-server-domain.com\\myusername"
:user_name => "myusername/my-mail-server-domain.com"
:user_name => "myusername#my-mail-server-domain.com"
but nothing works. Can anyone help me?
Regards.
Jason
i think you need to add
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:domain => "my-mail-server-domain.com",
:address => "mail.my-mail-server-domain.com",
:port => 25
:authentication => :login ,
:user_name => 'myusername',
:password => 'mypassword',
}
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.default_charset = "utf-8"
ActionMailer::Base.default_content_type = "text/html"
or try changing your port. usually port 25/26 is blocked to send emails, and some email providers are refusing to receive email from port 25 that uses localhost smtp.
Or maybe your internet provider is blocking port 25.
if it still doesn't work you could write the errors here.