Smtp - from field shows up blank in client

Hello,
I’m using the following code which is working fine except the from
address comes up blank.

smtp = Net::SMTP.start(‘smtp.mydomain.com’, 587, ‘mydomain.com’,
[email protected]’, ‘password’, :login) { |smtp|
smtp.send_message( msg, ‘[email protected]’,
[‘[email protected]’] )
}
The email goes out but it doesn’t tell me who it’s from.
In gmail the from is (Unknown Sender), In yahoo or others it’s blank.
What am I missing?

Max Payne wrote:

In gmail the from is (Unknown Sender), In yahoo or others it’s blank.
What am I missing?

Hello Max,

I think the from/to/subject needs to be part of your message, like this:
msg = <<EOF
From: Me my@address
To: You your@address
Subject: This email is a test.

This is the start of the message body…
EOF

Good luck,
Dan

Dan Z. wrote:

The email goes out but it doesn’t tell me who it’s from.
To: You your@address
Subject: This email is a test.

This is the start of the message body…
EOF

Good luck,
Dan

Also, if you’re missing the date, you’ll need to add that in. Check out
the example on my page here:
http://notepad.onghu.com/2007/3/26/sending-email-with-ruby

Cheers,
Mohit.
2/17/2008 | 4:00 PM.

On Feb 17, 3:00 am, Mohit S. [email protected] wrote:

}
Subject: This email is a test.
Cheers,
Mohit.
2/17/2008 | 4:00 PM.- Hide quoted text -

  • Show quoted text -

Thanks , putting it all in the message did the trick. Mohit thanks for
the great example. Now I need to figure out how to CC. The
send_message method takes a to and a from…

Max Payne wrote:

On Feb 17, 3:00 am, Mohit S. [email protected] wrote:

Also, if you’re missing the date, you’ll need to add that in. Check out
the example on my page here:http://notepad.onghu.com/2007/3/26/sending-email-with-ruby

Thanks , putting it all in the message did the trick. Mohit thanks for
the great example. Now I need to figure out how to CC. The
send_message method takes a to and a from…

Hi Max

I’ve never tried CC, so I don’t know. But, if you do get it, please
post here for future reference - I’ll also update the example on my page
after that.

Cheers,
Mohit.
2/18/2008 | 12:02 AM.

On Feb 17, 11:01 am, Mohit S. [email protected] wrote:

Hi Max

I’ve never tried CC, so I don’t know. But, if you do get it, please
post here for future reference - I’ll also update the example on my page
after that.

Cheers,
Mohit.
2/18/2008 | 12:02 AM.

I added a cc_mail var and an extra parameter for send_message and it
worked although I didn’t completely test. I received a [You were Cc’d]
message on my blackberry so I’m thrilled. If I had more cc’s then I
would have used an array of email addresses.

cc_mail = ‘[email protected]

msg = <<EOF
From: #{from_name}<#{from_mail}>
To: #{to_name}<#{to_mail}>
Cc: #{cc_mail}
Subject: E&D upload complete.

#{body}
Powered By Ruby
EOF

smtp = Net::SMTP.start(smtp_host, smtp_port, smtp_domain, smtp_user,
smtp_password, :login) { |smtp|
smtp.send_message(msg,smtp_user,to_mail,cc_mail)
}

Hi All,

I am facing a unique problem. Even though I am setting all the
parameters as found in many of the turorials, I am not getting the
subject header in the mail.

The code used :

msgstr = <<EOF
From: My Name [email protected]
To: Another Name [email protected]
Subject: test message
Date: Sat, 23 Jun 2001 16:26:43 +0900
Content-type: text/html

This is a test message.

EOF

from = ‘[email protected]
to = ‘[email protected]

Net::SMTP.start(‘my.mail.server’, 25) do |smtp|
smtp.send_message msgstr,from,to
end

The from is appearing in the mail from field, but the subject is not
getting populated. Please help me in this issue.

Thanks and Regards,
Anand.

Hi,

2009/6/24 Anand S. [email protected]:

  To: Another Name  [email protected]
Net::SMTP.start(‘my.mail.server’, 25) do |smtp|
 smtp.send_message msgstr,from,to
end

The from is appearing in the mail from field, but the subject is not
getting populated. Please help me in this issue.

You should remove spaces in front of each lines like this:

msgstr = <<EOF
From: My Name [email protected]
To: Another Name [email protected]
Subject: test message
Date: Sat, 23 Jun 2001 16:26:43 +0900
Content-type: text/html

This is a test message.
EOF

Regards,
Park H.

Thank you very much for the prompt reply. That worked …