Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending MIME multipart/alternate email

Status
Not open for further replies.

hellferret

Programmer
Mar 15, 2001
91
0
0
GB
I'm attempting to write a bulk email function that sends a MIME mulipart/alternate email so that it displays a text or html message depending on the recipient's client (which is unknown).

I'm currently under a big pile of things like MAPI, SMTP, CDONTS and all sorts of things I know very little about. Currently I'm using the Outlook Object Model (9.0) to control the sending of the mail - is it possible to do what I want using this or is there a better method??


HF
 
I would use CDONTS or CDO for Exchange 2000 (it's successor). This gives you control over the internet message formats at run-time.

In Outlook, these settings are under Tools | Options and aren't exposed in the object model

Paul Bent
Northwind IT Systems
 
i would go for an smtp mail

set imsg = createobject("cdo.message")
set iconf = createobject("cdo.configuration")

Set Flds = iConf.Fields
With Flds
.Item(" = 2
.Item(" = "mail.fsc.net" 'ToDo: Type a valid SMTP server name.
.Update
End With

strHTML = &quot;<HTML>&quot;
strHTML = strHTML & &quot;<HEAD>&quot;
strHTML = strHTML & &quot;<BODY>&quot;
strHTML = strHTML & &quot;<b> autoupdate xp</b></br>&quot;
strHTML = strHTML & &quot;<hr>&quot;
strHTML = strHTML & &quot;...</BR>&quot;
strHTML = strHTML & &quot;</BODY>&quot;
strHTML = strHTML & &quot;</HTML>&quot;
strSubject = strComputername & &quot;, autoupgrade to windows XP&quot;
strFrom = strComputername & &quot;@fujitsu-siemens.com&quot;
strAttachment = WshShell.ExpandEnvironmentStrings(&quot;%windir%&quot;) & &quot;\logFSC\XP-Upgrade\aupdxp.ini&quot;
iMsg.AddAttachment(strAttachment)

Set fldDump = FSO.GetFolder(WshShell.ExpandEnvironmentStrings(&quot;%windir%&quot;) & &quot;\LOGFSC\XP-Upgrade&quot;)

For Each aFile In fldDump.Files
'msgbox aFile
If Right(aFile,4) <> &quot;.bat&quot; Then
iMsg.AddAttachment(aFile)
End If
Next
Set fldDump = Nothing

With iMsg
Set .Configuration = iConf
.To = &quot;X-LAB@fujitsu-siemens.com&quot;
.From = strFrom
.Subject = strSubject
.HTMLBody = strHTML
.Send
End With
 
>ExpandEnvironmentStrings

<spit>

(see posts passim...)
 
strongm, i dont understand your ref to expandenvstr, nor do i understand the <spit>

nor the (see posts passim...)

are your posts VB commands i can use in a module?
or do i need some sort of sandals and socks translator for them??? perhaps a beard and specs would help??

 
Thanks guys.

I've tried using both SMTP and CDONTS methods. But have different problems with each.

SMTP: Fine with internal addresses - but failing on authentication when sending external. I'm assuming if I set the from address then the mail server will authenticate it the same way as if I sent an email through Outlook??

CDONTS/Outlook: This sends to external addresses fine, but the MIME formatting is wrong. The HTML version shows up fine but on a client that only recieves text they recieve a load of nonsense.

Would be very grateful if you could clear up suggest anything for either of these problems.




HF
 
not sure why the smtp would fail on external addresses. im pissing in the dark but dns issues with smtp mail server?
did you try setting the from address???
 
Thanks - solved the problem now. Our security admin had not allowed mail to be relayed outside from my IP.



HF
 
> i dont understand your ref to expandenvstr

Well, your solution includes a call to it...

>nor do i understand the <spit>

...I am not a fan of using environment strings if they can be avoided...

>nor the (see posts passim...)

...and I've explained my reasons on several occassions in posts to this forum in the past

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top