Universal Email file attachment problem
I use UE to send attachments to different users. I retrieve email and attachment (file2send) information from a database.
If the recordset contains just 1 record, everything works fine. More than 1 record and hell breaks lose (= hundreds of emails sent).
The file2send contains the physical path.
I'd appreciate som assistance, please...
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_dbburner_STRING
Recordset1.Source = "SELECT * FROM LOGBOG where keycode = '" & keycode & "' and email = '" & email & "'"
response.write(Recordset1.Source)
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
<!--#include file="../WA_Universal_Email/AspMail_VB.asp" -->
<!--#include file="../WA_Universal_Email/MailFormatting_VB.asp" -->
<%
function WA_Universal_Email_1_SendMail(RecipientEmail)
dim MailObject, MailAttachments, MailBCC, MailCC, MailTo, MailBodyFormat, MailBody, MailImportance, MailFrom, MailSubject
MailAttachments = ""
MailBCC = ""
MailCC = ""
MailTo = ""
MailBodyFormat = ""
MailBody = ""
MailImportance = ""
MailFrom = "John Doe|WA|john@company.com"
MailSubject = "Photos"
'Global Variables
gBodyFormat = ""
set WA_MailObject = WAUE_Definition("smtp.domain.com")
if (RecipientEmail <> "") then
set WA_MailObject = WAUE_AddRecipient(WA_MailObject,RecipientEmail)
else
'To Entries
end if
'Attachment Entries
while (NOT Recordset1.EOF)
set WA_MailObject = WAUE_AddAttachment(WA_MailObject,"" & cStr(Recordset1.Fields.Item("file2send").Value) & "")
Recordset1.MoveNext()
wend
if (Recordset1.CursorType > 0) then
Recordset1.MoveFirst
else
Recordset1.Requery
end if
'BCC Entries
'CC Entries
'Character Set
'Body Format
set WA_MailObject = WAUE_BodyFormat(WA_MailObject,0)
MailBodyFormat = gBodyFormat
'Set Importance
set WA_MailObject = WAUE_SetImportance(WA_MailObject,"3")
'Start Mail Body
MailBody = MailBody & "Cool"
'End Mail Body
set WA_MailObject = WAUE_SendMail(WA_MailObject,MailAttachments,MailBCC,MailCC,MailTo,MailImportance,MailFrom,MailSubject,MailBody)
set WA_MailObject = nothing
end function
%>
<%
if ((NOT (Recordset1.EOF AND Recordset1.BOF))) then
'WA Universal Email object="AspMail"
'Send Loop Once Per Entry
while (NOT Recordset1.EOF)
WA_Universal_Email_1_SendMail("" & cStr(Recordset1.Fields.Item("email").Value) & "")
Recordset1.MoveNext()
wend
if (Recordset1.CursorType > 0) then
Recordset1.MoveFirst
else
Recordset1.Requery
end if
'Send Mail All Entries
if (""<>"") then
Response.Redirect("")
end if
end if
%>