Professional Web Applications Themes

Problem with sending a mail - Ruby

Hi. I've this code: -------------------------------- #!/usr/bin/ruby require 'net/smtp' msg = <<END_OF_MESSAGE From: Dirk-From <de> To: Dirk-To <de> Subject: ruby test mail Date: #{Time.now.strftime("%a, %d %b %Y %H:%M:%S %z %Z")} Message-Id: <#{"%.8f" % Time.now.to_f}we-devedge.de> test text END_OF_MESSAGE Net::SMTP.start(server = 'pop3.we-devedge.de', port = 25) { |smtp|smtp.sendmail(msg, 'de', 'de') } -------------------------------- But I get a error 500 from /usr/lib/ruby/1.6/net/protocol.rb:164:in `conn_command' from /usr/lib/ruby/1.6/net/smtp.rb:238:in `do_start' from /usr/lib/ruby/1.6/net/protocol.rb:131:in `start' from /usr/lib/ruby/1.6/net/protocol.rb:71:in `start' from mail.rb:15 [Sat Feb 7 23:54:11 2004] [error] [client 80.139.26.35] Premature end of script headers: /kunden/we-devedge.de/ruby/htdocs/mail.rb Can anybody help me with this problem? What can I do? bye Dirk Einecke...

Sponsored Links
  1. #1

    Default Problem with sending a mail

    Hi.

    I've this code:

    --------------------------------

    #!/usr/bin/ruby
    require 'net/smtp'

    msg = <<END_OF_MESSAGE
    From: Dirk-From <de>
    To: Dirk-To <de>
    Subject: ruby test mail
    Date: #{Time.now.strftime("%a, %d %b %Y %H:%M:%S %z %Z")}
    Message-Id: <#{"%.8f" % Time.now.to_f}we-devedge.de>

    test text
    END_OF_MESSAGE

    Net::SMTP.start(server = 'pop3.we-devedge.de', port = 25) {
    |smtp|smtp.sendmail(msg, 'de', 'de') }

    --------------------------------

    But I get a error 500
    from /usr/lib/ruby/1.6/net/protocol.rb:164:in `conn_command'
    from /usr/lib/ruby/1.6/net/smtp.rb:238:in `do_start'
    from /usr/lib/ruby/1.6/net/protocol.rb:131:in `start'
    from /usr/lib/ruby/1.6/net/protocol.rb:71:in `start'
    from mail.rb:15
    [Sat Feb 7 23:54:11 2004] [error] [client 80.139.26.35] Premature end
    of script headers: /kunden/we-devedge.de/ruby/htdocs/mail.rb

    Can anybody help me with this problem?
    What can I do?

    bye
    Dirk Einecke
    Sponsored Links
    Dirk Guest

  2. #2

    Default Re: Problem with sending a mail

    Try this :
    smtp = Net::SMTP.new('smtp.we-devedge.de',25)
    smtp.start('we-devedge.de')
    smtp.ready('de', 'de') do |a|
    a.write msg
    end
    Noel

    Dirk Einecke wrote: 


    Noel Guest

  3. #3

    Default Re: Problem with sending a mail

    Hi,

    In mail "Problem with sending a mail"
    Dirk Einecke <de> wrote:
     
     
     

    You must send correct HELO domain (default is "localhost.localdomain").
    Give 3rd argument of Net::SMTP.start:

    Net::SMTP.start('pop3.we-devedge.de', 25, 'pop3.we-devedge.de') {|smtp|
    smtp.sendmail(msg, 'de', 'de')
    }


    Regards,
    Minero Aoki


    Minero Guest

  4. #4

    Default Re: Problem with sending a mail

    Hi.

    Ok - I have fixed my problem and all is fine - for now.
    Thank you.

    bye
    Dirk Einecke
    Dirk Guest

Similar Threads

  1. Sending Mail Problem
    By jester in forum ASP.NET Security
    Replies: 2
    Last Post: November 13th, 03:29 AM
  2. Problem sending HTML formated mail
    By SLanger@spirit21.de in forum PHP Development
    Replies: 0
    Last Post: September 17th, 06:48 AM
  3. problem when sending mail
    By scott john in forum PHP Development
    Replies: 3
    Last Post: August 22nd, 07:59 PM
  4. [PHP] Mail() Problem Sending
    By Ben C . in forum PHP Development
    Replies: 3
    Last Post: August 19th, 03:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139