Re: What is wrong in my script?



Ivan Vieira wrote:
require 'net/smtp'

def send_email(from, from_alias, to, to_alias, subject, message)
msg = <<END_OF_MESSAGE
From: #{from_alias} <#{from}>
To: #{to_alias} <#{to}>
Subject: #{subject}

#{message}
END_OF_MESSAGE

Net::SMTP.start("smpt.server", 25) do |smtp|
smtp.send_mail msg, from, to
end
end

send_email("from", "from_alias", "to", "to_alias", "subject", "message")


These are wild guess, due to the lack of error messages:
- No authentication provided to the mail server
- The RCPT email doesn't exist
- No HELO provided
- No SMTP server available at the address
- No network connection
- Wrong port

How to ask questions that can be answered in a more helpful manner:
http://www.catb.org/~esr/faqs/smart-questions.html

--
Phillip "CynicalRyan" Gawlowski
http://cynicalryan.110mb.com/

Rule of Open-Source Programming #8:

Open-Source is not a panacea.

.



Relevant Pages

  • Re: Authentication for outgoing TCP/IP Services mail?
    ... Why tie yourself to your ISP's mail server? ... forward all of it's mail out through the ISP's mailhub as a smarthost. ... However if your ISP's mailhub forces authentication then the latter becomes ... Get such functionality added to the mailserver software which is what ...
    (comp.os.vms)
  • mail server problem(postfix)
    ... My Mail Server is configured on FC3 ... My Scenario is such we have one catchall with the ISP i download all ... If the authentication is properly configured then why the mails are ... Please set your mailserver up so that it sends out mail through your ISP's ...
    (Fedora)
  • Re: how to allow ANY username & password combo for SMTP Authentication
    ... I am trying to setup sendmail using SMTP Authentication to allow ANY ... username and password combo sent to it to be correctly authenticated. ... Currently as it stands it redirects to our mail server but wont ...
    (comp.mail.sendmail)
  • Re: Problem with replying to an incoming email
    ... "my server requires authentication" box in your email configuration. ... Click "Outgoing Mail Server requires authentication" and make sure ... Click on "Advanced Tab" ... Click Ok and then Test Account Settings ...
    (microsoft.public.outlook.general)
  • Re: Cant send email through some wifi
    ... > "Authentication failed because Entourage doesn't support any of the ... authentication set on and off in the 'advanced sending options' of the ... account preferences. ... look to using Postfix Enabler to turn on the mail server ...
    (microsoft.public.mac.office.entourage)