Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 702007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:40:22+00:00 2026-05-14T03:40:22+00:00

I’m trying to send simple email via Ruby (no rails) on OS X, with

  • 0

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T03:40:23+00:00Added an answer on May 14, 2026 at 3:40 am

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.