Discussion: net/smtp question
Afficher un message
Vieux 14/09/2007, 05h49   #2
Mohit Sindhwani
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: net/smtp question

Michael Linfield wrote:
> Ive tried several examples from numerous books trying to send mail with
> net smtp and i never really get the emails.
>
> require 'net/smtp'
>
> message = <<MESSAGE_END
> From: Nobody <nobody@power.net>
> To: Someone <someone@hotmail.com>
> Subject: Test SMTP
>
> i pray that itll work
> MESSAGE_END
>
> Net::SMTP.start('mx1.hotmail.com') do |smtp|
> smtp.send_message message, 'nobody@power.net', 'someone@hotmail.com'
> end
>
> #####
> This was one example, i receive no errors indicating a problem but when
> checking my email IE: someone@hotmail.com i dont have it in any
> folders, not inbox or junkmail.
>
> Another version that i modified to fit my own needs was this ----
>
> require 'net/smtp'
>
> puts "Sender: "
> sender = gets.chomp
> puts "Recipient: "
> rcpt = gets.chomp
> puts "Message: "
> msg = gets.chomp
>
> smtp = Net::SMTP.new('mx1.hotmail.com')
>
> smtp.start()
>
> smtp.ready(sender, rcpt) do |mail|
>
> mail.write msg
>
> end
>
> #########
> once again no errors
>
> any ideas why i might not be getting the emails?
>


I know I'm not directly answering your question, but there's a sample on
my blog:
http://notepad.onghu.com/ruby

I think it would be good for you to try to send it to some other email
address, perhaps, you are missing some fields which make your mail look
like spam and is being dropped by something along the way?

Cheers,
Mohit.
9/14/2007 | 12:49 PM.




  Réponse avec citation
 
Page generated in 0,06212 seconds with 9 queries