By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How Does the /Image Option for SENDHTML Work?

Neither the WhatsNew file nor the help describes precisely how this option is used. Where do the images get embedded in the HTML message file?

This is potentially something I have long wanted. Until now, I have placed images that I want to include on a web server and use the img tag to display the image in the email message at the desired location. The problem with that is that some mail readers do not automatically display embedded images from a server.
I wonder if it really works. I gave this command.

sendhtml /E"[email protected]" /image="v:\int-flighter.png" [email protected] foo bar

The SMTP server is localhost. The server accepted the email and queued it for delivery (it can't really deliver it). The log doesn't look like there's a PNG in there.


And the biggest file in the outgoing queue is 855 bytes. I doubt it has a 1MB PNG file in it. I tried again specifying a JPG; that was no better.

FWIW, SENDMAIL does successfully send images as attachments (/A).
OK, I bit the bullet and installed TCMD30 so that I could experiment. I think I figured it out.

One uses /image=file arguments to specify files for use in the message. Then one uses normal img tags with the name of the file (without any path) to embed the image in the text. I wrote a test HTML file of the form:

<p>First paragraph</p> <img src="filename.jpg"> <p>Last paragraph</p>

Then I invoked SENDHTML with the argument


That did just what I wanted; the image appeared between the two paragraphs.

However, when I tried to embed two images, the command line failed with the message "TCC: SMTP protocol error. 554 5.5.1 Error: no valid recipients." It appears that including two /image="filename" arguments messed up the parsing of the command. The help file does say "You can specify multiple /Image="..." arguments."
Whoa! When I omitted the second /image argument and sent the message, it actually worked! The message arrived with the TWO images embedded, even though the second one was not specified.

So, I removed BOTH /image arguments, and it still worked! That leaves me wondering just what the /image argument is actually doing.
Now I just tried the SENDHTML command in version 27, and it works there as well! I never realized that an img tag could reference a local file and cause that file to be encoded into the message.

Well, that led me to try one more experiment in verson 30. I put in the /image argument but did not include an img tag in the message file. The resulting message was just the same as using the command without the /image argument.
When I use an HTM file, the email accepted by the server does contain the specified image file. I can't test further because the email can't actually be delivered
When I use an HTM file, the email accepted by the server does contain the specified image file.

But what role does any /image=file have on the message. As I reported, (1) it does not seem to be necessary to use such any such argument in order to embed a local image file and (2) contrary to the documentation, it seems that one cannot have more than one /image argument.

I wish that Rex would respond to this, as he must know what that argument was intended to accomplish and whether I am misunderstanding something about it.

By the way, Vince, why can't you send yourself a message? I had no trouble doing that (multiple times). I wrote a complex BTM file to implement a mass-mailing program. It uses a master HTML file with parameters that has data substituted from the mailing list using TPIPE to search-and-replace the parameter. Then the messages are sent using SENDHTML. I use that program frequently in my (volunteer) work.

Similar threads