You are not sending an email with an attached image,
you are only sending an email in HTML format,
which happens to contain some link.
I have never used Net::SMTP, so I can not tell you
how you would actually attach an image to an email.
Try searching for ‘ruby net smtp attachment’ or so…
Hi
Instead of attachment, Can i not imbedded the image ??
if i do attachment, Then it will sent as Attachment
but what i am trying to do is, the image will be seen in body of the
Email rather then attachment.
Sending images, or other non-text data, in an email has to be done as an
attachment. The difference is whether it is an inline attachment or
not. You want an inline attachment.
Sending emails with attachments is way more complicated than what you
have tried. Do a search for multipart email format and inline
attachments.
What do you mean “no luck”? Is the message sent and received, but
without the image? Does the code crash? Does it not arrive at all?
Maybe it’s rejected by a spam filter?
but i dont see the image …
you could try puts message instead of sending it.
is the image included in the output string?
Sorry did not understand what you meant…
First, look at the source code of the email you received.
If the image is embedded but not displayed, it could be
a problem with your email program.
If the image is not embedded in the first place you have to
poke into the code and try to figure out what is going on…
The simplest way to debug some code is including puts statements
to display the values of your variables, like src, message.
did you try saving the HTML part of the message
into a file and open it with a browser?
how you want me to save this in to html ?? by using ruby cgi ??
This has nothing to do with cgi. Just change your program like shown
below and run it. This saves the HTML snippet of your message to a file
(instead of sending it). Then open the created HTML file in your
browser. Does it display your image? (In my case it does.)