dougcranston
Technical User
I have the need to send an HTML formatted email due to a table layout, plus attach a number of Word and Excel documents.
The script I have created does this, however, what is viewable in the received email is the HTML and the uploaded files starting at the RIGHT of the html content and continuing to the bottom of the HTML.
Is there some way I can force the attachments to appear at the end of the document?
Environment:
=============
Server IIS 5
Email program: CDO/CDOSYS
Client: Email client is Lotus Notes.
Web Client: Web based version is Lotus WebNotes.
Script Sample:
===============
function sndEmail(ScriptType, strFrom, strTo, strCc, strSubject, strBody) {
var strScriptType = new String(ScriptType);
strScriptType = Trim(strScriptType);
strScriptType = strScriptType.toUpperCase();
var strMailFrom = new String(strFrom);
var strMailTo = new String(strTo);
var strMailSubject = new String(strSubject);
var strMailCc = new String(strCc);
var strMailBody = new String(strBody);
// Create CDO object depending on Script_Type
// Script_Type can be ASP(run on an asp page) or JS(run through a jScript)
if (strScriptType == "ASP") {
var cdoMessage = Server.CreateObject("CDO.Message");
var cdoConfig = Server.CreateObject("CDO.Configuration");
}
if (strScriptType == "JS") {
var cdoMessage = new ActiveXObject("CDO.Message");
var cdoConfig = new ActiveXObject("CDO.Configuration");
}
// assign ref for cdo
var cdoSendUsingMethod = " var cdoSMTPServer = " var cdoSMTPServerPort = "
// assign values to be used by cdo
cdoConfig.Fields.Item(cdoSMTPServer) = "smtp.servername.com";
cdoConfig.Fields.Item(cdoSMTPServerPort) = 25;
cdoConfig.Fields.Item(cdoSendUsingMethod) = 2;
cdoConfig.Fields.Update();
// update the message configuration for cdo
cdoMessage.Configuration = cdoConfig;
cdoMessage.To = strMailTo;
cdoMessage.From = strMailFrom;
cdoMessage.Subject = strMailSubject;
cdoMessage.Cc = strMailCc;
// assign the body text for the message
cdoMessage.HTMLBody = strMailBody;
cdoMessage.AddAttachment('e:\\inetpub\\ cdoMessage.AddAttachment('e:\\inetpub\\ cdoMessage.AddAttachment('e:\\inetpub\\ cdoMessage.AddAttachment('e:\\inetpub\\ cdoMessage.AddAttachment('e:\\inetpub\\ cdoMessage.AddAttachment('e:\\inetpub\\ cdoMessage.AddAttachment('e:\\inetpub\\ cdoMessage.AddAttachment('e:\\inetpub\\ cdoMessage.AddAttachment('e:\\inetpub\\ cdoMessage.AddAttachment('e:\\inetpub\\// send the msg
cdoMessage.Fields.Update();
cdoMessage.Send();
// release the objects once done
cdoMessage = null;
cdoConfig = null;
}
I found a reference in the CDO.CHM file that refers to an Attachment Position property, but I cannot figure a way to try to use that as I read it, it wants the Character position, and I have no idea what that will be from email to email.
Any ideas would be appreciated.
Thanks in advance.
Dougc
The script I have created does this, however, what is viewable in the received email is the HTML and the uploaded files starting at the RIGHT of the html content and continuing to the bottom of the HTML.
Is there some way I can force the attachments to appear at the end of the document?
Environment:
=============
Server IIS 5
Email program: CDO/CDOSYS
Client: Email client is Lotus Notes.
Web Client: Web based version is Lotus WebNotes.
Script Sample:
===============
function sndEmail(ScriptType, strFrom, strTo, strCc, strSubject, strBody) {
var strScriptType = new String(ScriptType);
strScriptType = Trim(strScriptType);
strScriptType = strScriptType.toUpperCase();
var strMailFrom = new String(strFrom);
var strMailTo = new String(strTo);
var strMailSubject = new String(strSubject);
var strMailCc = new String(strCc);
var strMailBody = new String(strBody);
// Create CDO object depending on Script_Type
// Script_Type can be ASP(run on an asp page) or JS(run through a jScript)
if (strScriptType == "ASP") {
var cdoMessage = Server.CreateObject("CDO.Message");
var cdoConfig = Server.CreateObject("CDO.Configuration");
}
if (strScriptType == "JS") {
var cdoMessage = new ActiveXObject("CDO.Message");
var cdoConfig = new ActiveXObject("CDO.Configuration");
}
// assign ref for cdo
var cdoSendUsingMethod = " var cdoSMTPServer = " var cdoSMTPServerPort = "
// assign values to be used by cdo
cdoConfig.Fields.Item(cdoSMTPServer) = "smtp.servername.com";
cdoConfig.Fields.Item(cdoSMTPServerPort) = 25;
cdoConfig.Fields.Item(cdoSendUsingMethod) = 2;
cdoConfig.Fields.Update();
// update the message configuration for cdo
cdoMessage.Configuration = cdoConfig;
cdoMessage.To = strMailTo;
cdoMessage.From = strMailFrom;
cdoMessage.Subject = strMailSubject;
cdoMessage.Cc = strMailCc;
// assign the body text for the message
cdoMessage.HTMLBody = strMailBody;
cdoMessage.AddAttachment('e:\\inetpub\\ cdoMessage.AddAttachment('e:\\inetpub\\ cdoMessage.AddAttachment('e:\\inetpub\\ cdoMessage.AddAttachment('e:\\inetpub\\ cdoMessage.AddAttachment('e:\\inetpub\\ cdoMessage.AddAttachment('e:\\inetpub\\ cdoMessage.AddAttachment('e:\\inetpub\\ cdoMessage.AddAttachment('e:\\inetpub\\ cdoMessage.AddAttachment('e:\\inetpub\\ cdoMessage.AddAttachment('e:\\inetpub\\// send the msg
cdoMessage.Fields.Update();
cdoMessage.Send();
// release the objects once done
cdoMessage = null;
cdoConfig = null;
}
I found a reference in the CDO.CHM file that refers to an Attachment Position property, but I cannot figure a way to try to use that as I read it, it wants the Character position, and I have no idea what that will be from email to email.
Any ideas would be appreciated.
Thanks in advance.
Dougc