West Wind Internet and Client Tools
Switching from wwIPStuff to wwSmtp
Gravatar is a globally recognized avatar based on your email address. Switching from wwIPStuff to wwSmtp
  Sam Burns
  All
  Feb 7, 2026 @ 05:38am

Blast from the past here but I have a class that uses wwIPStuff to send emails with attachments perfectly, using the SendMail method. The main body is simple html with an embedded image and usually a single attachment of some sort like a PDF or XLS. Switching to use wwSmtp, if I use mode 2 which is classic mode, everything still works perfectly. If I switch to use mode 0 (.NET) then the email that gets sent is text with all the raw mime with base64 encoded text and no attachment.

My question is: is this expected behavior without doing extra work of using the wwSmtp methods like AddAlternateView, AddAttachment? I use the code below to log all the info from the email and it is byte for byte the same when using either approach.

If I just do something like call AddAttachment with the file in wwSmtp mode 0 then the file attachment does get attached (though the message is still unprocessed mime text), so maybe I just have to bite the bullet and update all the code, but I was hoping the switch to wwSmtp and using .NET mode would have been as easy as just using the new class and keeping all the other behaviors the same.

Thanks!

Updated to add: bridge connector dll version is 7.4.2.0, Client Tools dll version is 7.4.0.0

local lcOutFile
lcOutFile = g_tmp_path + "\wwsmtp." + dt_curr() + ".txt"
strtofile("from:    " + loSmtp.cSenderEmail + CRLF, lcOutFile, 0)
strtofile("to:      " + loSmtp.cRecipient   + CRLF, lcOutFile, 1)
strtofile("cc:      " + loSmtp.cCcList      + CRLF, lcOutFile, 1)
strtofile("bcc:     " + loSmtp.cBccList     + CRLF, lcOutFile, 1)
strtofile("subject: " + loSmtp.cSubject     + CRLF, lcOutFile, 1)
strtofile(CRLF,             lcOutFile, 1)
strtofile(loEmail.emheader, lcOutFile, 1)
strtofile(CRLF,             lcOutFile, 1)
strtofile(loEmail.embody,   lcOutFile, 1)
Gravatar is a globally recognized avatar based on your email address. re: Switching from wwIPStuff to wwSmtp
  Rick Strahl
  Sam Burns
  Feb 8, 2026 @ 10:05am

You should show your code.

If you send Html emails you need to specify the content type for anything other than plain text. In your case the content type will be text/html.

Note the content type.

When you say you embed the image what does that mean exactly? Are you embedding a data: Url?

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Switching from wwIPStuff to wwSmtp
  Sam Burns
  Rick Strahl
  Feb 9, 2026 @ 04:22am

All the formatting is set correctly because the message sending works perfectly using ipstuff and wwsmtp in classic mode.

The html has an embedded image using the mime encoding as shown below. This is literally all of the text - ignore the fact there's a warning, that's because of a file I didn't have on disk when the message was being sent.

So as mentioned above in ipstuff mode or .net classic this message is received with perfectly formed html and an attachment, if sent in .net mode 0 with wwsmtp it is received literally as you see it here, unprocessed.

I can show code if necessary, but I am hoping this rings a bell for someone.

Thanks!

from:    XXX
to:      XXX
cc:      
bcc:     
subject: XXX


This is a multi-part message in MIME format.

--_OC_MIME_MAIN_
Content-Type: multipart/related;
	boundary="_OC_MIME_SUB1_"

--_OC_MIME_SUB1_
Content-Type: multipart/alternative;
	boundary="_OC_MIME_SUB2_"

--_OC_MIME_SUB2_
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

XXX

some extra text

The following PDF file is attached: XXX



--_OC_MIME_SUB2_
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: base64

PGh0bWw+PGhlYWQ+DQo8bWV0YSBodHRwLWVxdWl2PSJDb250ZW50LVR5cGUiIGNv
bnRlbnQ9InRleHQvaHRtbDtjaGFyc2V0PWlzby04ODU5LTEiPg0KPC9oZWFkPjxi
b2R5Pg0KPHRhYmxlIHdpZHRoPSIxMDAlIj48dHI+PHRkIGFsaWduPWxlZnQ+PGlt
ZyBhbHQ9IkxvZ28iIHNyYz0iY2lkOjdFMjFEUkhOQSI+PC90ZD4NCjx0ZCBhbGln
bj1yaWdodCB2YWxpZ249Ym90dG9tIG5vd3JhcD48Yj48Zm9udCBmYWNlPSJBcmlh
bCIgc2l6ZT00PlhYWDwvZm9udD48L2I+DQo8L3RkPjwvdHI+PC90YWJsZT48aHI+
PGJyPg0KPGZvbnQgZmFjZT0iQXJpYWwiIHNpemU9Mj5zb21lIGV4dHJhIHRleHQ8
YnI+PGJyPjwvZm9udD48dGFibGUgY2VsbHNwYWNpbmc9MD48dHI+PHRkIGFsaWdu
PXJpZ2h0IHZhbGlnbj10b3Agbm93cmFwPjxmb250IGZhY2U9IkFyaWFsIiBzaXpl
PTI+PGI+VGhlIGZvbGxvd2luZyBQREYgZmlsZSBpcyBhdHRhY2hlZDombmJzcCZu
YnNwPC9iPjwvZm9udD48L3RkPg0KPHRkIGFsaWduPWxlZnQgdmFsaWduPXRvcD48
Zm9udCBmYWNlPSJBcmlhbCIgc2l6ZT0yPjxiPlhYWDwvYj48L2ZvbnQ+PC90ZD48
L3RyPg0KPC90YWJsZT48L2JvZHk+PC9odG1sPg0K

--_OC_MIME_SUB2_--

--_OC_MIME_SUB1_
Content-Type: application/octet-stream; name="omnilogo.gif"; access-type="content-id"
Content-Transfer-Encoding: base64
Content-ID: <7E21DRHNA>

R0lGODlh1wAvAOYAAEmyVez37nfIgrfivUy3Wp7Yptfr11+/bP///47OlsfpzK/ftuDz4mnD
dVa7ZIXOj/T79ZTUncLnx6XbrHLGfeb16FG2YdLt1ki2V7zkwn3LiF26afH58mW+cdvw3qrd
sbXhu87r0prXovv9++j26pHTmm3CdaHZqE+4XeP05lW7Yli8ZonQkoDMitnw3HTHf8boy0m2
WGbCcrLguO7473rKhU24XFq9aL7jxpbVnuLz5PP69FK6YLnjvt/v32zEeMrqzvb79l2+ao7S
l9jv2/D58ofPkWC/bajcr6Laqq7bsnzKhoLKjqLXprHgt+v37JbSnm3FeWnCcXbIgabcrufz
67rjwsLnynnGhsrnztXu2N7y4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAACH5BAAHAP8ALAAAAADXAC8AAAf/gAiCg4SFhoeEIxcTGjI8
PA5RQz0piJaXmJmam5ydnp+goZ8cOEMNKjEYqqsYNkI1Ey6is7S1t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FnJyDPHWiWCm4K1Ac0OyIFjLZ2hVDAEKJwgBscYQkTQFdoHVfbI7zgLEfSwmgjB5TRqrMY
y8uIDZabEQiGYgdPuEmHONE8RFR3HcQySUZgMt3utqOu2p0HKL1LXmoU4ZXhRUcSysvecFTg
eOn9RSXbS19qVEBo8QXG+erL32ksJ7+sIEAP+ktgaiwgqdqlgG4LzGBjVOBuJjkANGgbTGFj
bKEEW0JHAyxT4Q4nYwcSGMIPHEDCl7wiFh5OMTW08IEHUIoHB6BABDKwVRV3OBAAOw==

--_OC_MIME_SUB1_--

--_OC_MIME_MAIN_
Content-type: application/octet-stream
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
	filename="warning.txt"

Unable to attach file XXX.pdf
file {65AEC4F0-F10B-4793-914A-6936E2E15F1C} not found on disk.

--_OC_MIME_MAIN_--

Gravatar is a globally recognized avatar based on your email address. re: Switching from wwIPStuff to wwSmtp
  Rick Strahl
  Sam Burns
  Feb 10, 2026 @ 09:57am

What does the text you're sending look like? Are you mime encoding before you send the message? IOW, are you passing Mime encoded text to the message? That's the only reason I could think that would result in this behavior. The old version would likely pass through the raw Mime text and that's why it might work, but it wouldn't work with a proper mail client that

I'm not sure what you mean by embedded image as that can mean a number of different things - especially for Html emails. How are you embedding the image in the mail? That's why I'm asking to see your code - including the content of the text that's being sent.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Switching from wwIPStuff to wwSmtp
  Sam Burns
  Rick Strahl
  Feb 10, 2026 @ 10:30am

Hi thanks for replying again, and yes the original code was written in about 2014 so it just mime encoded everything including the embedded image. I included an example of the message being sent in my previous reply but your point about how the older client and classic client would properly just handle the message properly matches my experience.

The existing code is a bit complex because it is literally converting everything to mime and base64. Also by embedded image I mean the text below.

I am going to try and update the code to just use the proper methods you gave in your example and I'm sure it will work.

Thanks again!

--OC_MIME_SUB1 Content-Type: application/octet-stream; name="omnilogo.gif"; access-type="content-id" Content-Transfer-Encoding: base64 Content-ID: <7E21DRHNA>

R0lGOD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ElzFFTAxOGesYAmFihb8DkeLKHGDSqCYGNQuQYJSdWlUGoJW9FZRw0F88YDbQ8ACMdBDm5wx iDUTxAdWgUdLoLAGF1CAJolQgeYpkf+Js5jfLwhgLE4g8BlEPIS8WmiJFBxgFTeIUBcNccgc JnKRjSyEGYEYwUiKx20BuMT+MBAxTXwyF9tyhmg8gcJnrM52ycIAC6CIgCDMYEuQ+iXnvHhD RKpihwwkxC4xAMHxCUJvDdCBIWQhCCnWwGsj6I3AfkdHWgSgVFPsBBFi+IyU8ZFfqxCACBYw ASMcz4WD3CYtu2nLb44xnBd6ZC/xxkVfGGEGLitAPDhCA3UJ4QRA2MIWFFAAIajwmLloFjdq IE9MSOBhz3CfJp6gt23wgImzLEQtCyFGRZLRkbw0pyBwwA0KXOYC/ARGxlCKi/ShwwHDsMQW RKlMT3wgRsD/MEIpBUGEVdSvEPy6wSHadRWuqYKKulzFCwah0lJeAG2+WEKEGBA3Z9wgY1Z8 Tut4Z4wazOMGEZCADmhAAxIQwQl+nUc2NxGEDDzgCDwgAAFu8IIJmA4RNKCCZhcbmwlMIGOE CIFnJyDPHWiWCm4K1Ac0OyIFjLZ2hVDAEKJwgBscYQkTQFdoHVfbI7zgLEfSwmgjB5TRqrMY y8uIDZabEQiGYgdPuEmHONE8RFR3HcQySUZgMt3utqOu2p0HKL1LXmoU4ZXhRUcSysvecFTg eOn9RSXbS19qVEBo8QXG+erL32ksJ7+sIEAP+ktgaiwgqdqlgG4LzGBjVOBuJjkANGgbTGFj bKEEW0JHAyxT4Q4nYwcSGMIPHEDCl7wiFh5OMTW08IEHUIoHB6BABDKwVRV3OBAAOw==

Gravatar is a globally recognized avatar based on your email address. re: Switching from wwIPStuff to wwSmtp
  Rick Strahl
  Sam Burns
  Feb 11, 2026 @ 12:29pm

Well if you send already encoded text that's not going to work with a proper mail client. I think using existing Mime encoded text was a workaround from a long time ago to just pass it straight through to the raw socket code.

You should be able to do what you need with the proper mail api though and it'll be a lot simpler than creating the mime encoding by hand.

I can't recall the details of how to embed images into emails in the body - it's a pain in the ass even with the proper client - I think you have to assign an attachment Id and then link the attachment id in the image source.

It might be easier to just generate an Html email and embed the image as a binary image data:b64 tag directly into the body. Limitations with that approach too unfortunately.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Switching from wwIPStuff to wwSmtp
  Sam Burns
  Rick Strahl
  Feb 12, 2026 @ 04:20am

Thank you Rick, I'll figure it out and post an update to close the loop when I am done. You have a lot of good example code and there's lots of info on the forum here so I'm confident I'll get it working.

Much appreciated, Sam.

Gravatar is a globally recognized avatar based on your email address. re: Switching from wwIPStuff to wwSmtp
  Sam Burns
  Rick Strahl
  Feb 12, 2026 @ 11:47am

Ach I was too hopeful, the code below gives me this error. I used the sample code from wwSMTP::AddAlternateView

Addl Err Info Method 'System.DBNull.ContentId' not found. Program Name PROCEDURE WWDOTNETBRIDGE.SETPROPERTY WWDOTNETBRIDGE.FXP Stack ( 12) Line 479, wwdotnetbridge.setproperty in wwdotnetbridge.prg
Stack ( 11) Line 997, wwsmtpalternateview.addlinkedresource in wwsmtp.prg

loSmtp = createobject("wwSmtp", 0)
loSmtp.cMailServer   = .icServer
loSmtp.nServerPort	 = .inSmtpPort
loSmtp.cUsername     = .icUsername
loSmtp.cPassword     = .icPassword
loSmtp.cSenderName   = loEmail.emfrom
loSmtp.cSenderEmail  = loEmail.emfrom
loSmtp.cRecipient    = loEmail.emto
loSmtp.cCcList       = loEmail.emcc
loSmtp.cBccList      = loEmail.embcc
loSmtp.cSubject      = loEmail.emsubject

loSmtp.lUseSsl = .ilUseSsl

loSmtp.cSubject = "Test Message through wwSmtp"
loSmtp.cMessage = "This message contains rich text content as an alternate view"
loSmtp.cContentType = "text/plain"				
LOCAL loAlternateView as wwSmtpAlternateView
loAlternateView = CREATEOBJECT("wwSmtpAlternateView")
loAlternateView.cText = "<b>Hello</b> World! <img src='cid:logo' />"
loAlternateView.cContentType = "text/html"
loAlternateView.AddLinkedResource("logo.gif","image/gif","logo")
loSmtp.AddAlternateView( loAlternateView )								

loSmtp.SendMail()

Gravatar is a globally recognized avatar based on your email address. re: Switching from wwIPStuff to wwSmtp
  Rick Strahl
  Sam Burns
  Feb 12, 2026 @ 02:25pm

Hmmm... I took your code verbatim and it works for me:

Make sure the image file exists and the content type is correct. AddAlternateView() fails if the image file cannot resolve.

FWIW adding the ability to check to AddAlternateView():

*************************************************************
DEFINE CLASS wwSmtpAlternateView AS Custom
*************************************************************
*: Author: Rick Strahl
*:         (c) West Wind Technologies, 2009
*:Contact: http://www.west-wind.com
*:Created: 09/04/2009
*************************************************************

cText = ""
cContentType = "text/plain"
cErrorMsg = ""

oLinkedResources = null

************************************************************************
* wwSmtpAlternateView ::  Init
****************************************
FUNCTION Init()
this.oLinkedResources = CREATEOBJECT("Collection")
ENDFUNC
*  wwSmtpAlternateView ::  Init

************************************************************************
* wwSmtpAlternateView ::  AddLinkedResource
****************************************
***  Function: Adds an embedded resource to a message
***      Pass: lcFileName  -  file name to resource
***            lcContentType -  ContentType (ie. text/html)
***            lcContentId   -  An identifier for this resource so it 
***                             can be embedded
***    Return: nothing
************************************************************************
FUNCTION AddLinkedResource(lcFileName, lcContentType, lcId)

IF (!FILE(lcFileName)
   this.cErrorMsg = "Linked resource file not found."
   RETURN .F
ENDIF

loBridge = CREATEOBJECT("wwDotNetBridge")
loResource = loBridge.CreateInstance("System.Net.Mail.LinkedResource",lcFileName,lcContentType)
IF (loResource == null)
   this.cErrorMsg = "Couldn't add linked resource." 
   RETURN .F.
ENDIF

loBridge.SetProperty(loResource,"ContentId",lcId)

this.oLinkedResources.Add(loResource)

RETURN .t.
ENDFUNC
*  wwSmtpAlternateView ::  AddLionkedResource

ENDDEFINE

Using the updated method you can check for errors:

IF (!loAlternateView.AddLinkedResource(".\samples\wwDotnetBridge\sailbig.jpsg","image/jpeg","SailBig"))
   ? loAlternateView.cErrorMsg
   RETURN
ENDIF

loSmtp.AddAlternateView( loAlternateView )								

? loSmtp.SendMail()
? loSmtp.cErrorMsg

+++ Rick ---

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Switching from wwIPStuff to wwSmtp
  Sam Burns
  Rick Strahl
  Feb 12, 2026 @ 06:11pm

Thanks Rick I'll check it out and report back.

Gravatar is a globally recognized avatar based on your email address. re: Switching from wwIPStuff to wwSmtp
  Sam Burns
  Rick Strahl
  Feb 13, 2026 @ 09:34am

That worked Rick, the file not being in the correct place was the problem. Now I have a working proof of concept I expect complete success to be just around the corner.

Thanks again for your insights and extra code, always appreciated.

Sam.

© 1996-2026