smtp - from field shows up blank in client

M

Max Payne

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',
'(e-mail address removed)', 'password', :login) { |smtp|
smtp.send_message( msg, '(e-mail address removed)',
['(e-mail address removed)'] )
}
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?
 
D

Dan Zwell

Max said:
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',
'(e-mail address removed)', 'password', :login) { |smtp|
smtp.send_message( msg, '(e-mail address removed)',
['(e-mail address removed)'] )
}
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?

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
 
M

Mohit Sindhwani

Dan said:
Max said:
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',
'(e-mail address removed)', 'password', :login) { |smtp|
smtp.send_message( msg, '(e-mail address removed)',
['(e-mail address removed)'] )
}
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?

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

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.
 
M

Max Payne

Dan said:
Max said:
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',
'(e-mail address removed)', 'password', :login) { |smtp|
  smtp.send_message( msg,  '(e-mail address removed)',
['(e-mail address removed)'] )
}
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?
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

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.- 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...
 
M

Mohit Sindhwani

Max said:
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.
 
M

Max Payne

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 = '(e-mail address removed)'

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)
}
 
A

Anand Srinu

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 = '(e-mail address removed)'
to = '(e-mail address removed)'

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.
 
H

Heesob Park

Hi,

2009/6/24 Anand Srinu said:
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 =3D <<EOF
=C2=A0 =C2=A0From: My Name <[email protected]>
=C2=A0 =C2=A0To: Another Name =C2=A0<[email protected]>
=C2=A0 =C2=A0Subject: test message
=C2=A0 =C2=A0Date: Sat, 23 Jun 2001 16:26:43 +0900
=C2=A0 =C2=A0Content-type: text/html

=C2=A0 =C2=A0This is a test message.
EOF

from =C2=A0=3D '(e-mail address removed)'
to =3D '(e-mail address removed)'

Net::SMTP.start('my.mail.server', 25) do |smtp|
=C2=A0smtp.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 =3D <<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 Heesob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,149
Latest member
Vinay Kumar Nevatia0
Top