From: Brian Candler Date: 2011-01-31T17:21:29+09:00 Subject: Re: How deliver emails with sender's name Marco Mastrodonato wrote in post #978597: > Sometimes i need to specify a name to show it when email is received. > Into "from" field i use this format: > addresser > > To do this i have to update smtp.rb file: > #C:\ruby\ruby-187p330\lib\ruby\1.8\net\smtp.rb > > def mailfrom(from_addr) > if $SAFE > 0 > raise SecurityError, 'tainted from_addr' if from_addr.tainted? > end > #getok("MAIL FROM:<#{from_addr}>") #before > str = from_addr.to_s =~ /<.+>/ ? from_addr.to_s.match(/<.+>/).to_s > : "<#{from_addr}>" #marcomd > getok("MAIL FROM:#{str}") #marcomd > end mailfrom is for the SMTP envelope. You should only ever pass it a bare E-mail address, never an RFC 2822 name-addr (comment plus E-mail address in angle brackets). In other words: your client code should strip this out before calling send_message or open_message_stream, you don't need to hack Net::SMTP to do this. -- Posted via http://www.ruby-forum.com/.