PDA

View Full Version : i have no error but the email not send


bmwmpower
05-11-2003, 08:49 AM
i have no error so why the email not send
this is the code


Set arrTo = Session("arrTo")
Set arrCc = Session("arrCC")
Set arrBcc = Session("arrBcc")
Set arrFiles = Session("arrFiles")

If Request("SEND") <> "" Then

Set SendEmail = Server.CreateObject("SMTPsvg.Mailer")
SendEmail.RemoteHost = "mail.nbcbn.com"
SendEmail.FromName = Request("yourname") 'Specify sender's address
SendEmail.FromAddress= Request("youremail")

'===================================== To

' get addresses from collections
Items = arrTo.Items
For i = 0 to arrTo.Count - 1
SendEmail.AddRecipient "",Items(i)

Next
'=================================== Cc

Items = arrCc.Items
For i = 0 to arrCc.Count - 1
SendEmail.AddCC "",Items(i)

Next
'====================================== Attachment

C=server.mappath("Attachment")
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(C)
Set fc = f.Files
For Each f1 in fc
cf= c & "\" & f1.name
SendEmail.AddAttachment cf
next
'=============================================


SendEmail.Subject = Request.form("Subject")
SendEmail.BodyText = request.form("Msg")
SendEmail.ContentType ="text/html"


'------------------------------------------------------------------------------

ErrStr = ""

If Err <> 0 Then
ErrStr = Err.Description
Else
arrTo.RemoveAll
arrCc.RemoveAll
arrBcc.RemoveAll
arrFiles.RemoveAll
ErrStr = "success"
'----------------- Delete Attachment
For Each f1 in fc
cf= c & "\" & f1.name
fso.DeleteFile cf
next
End If
On Error Goto 0 ' cancel On Error Resume Next
Else

On Error Resume Next
if not Mail.Send Then
ErrStr = Err.Description
Else
arrTo.RemoveAll
arrCc.RemoveAll
arrBcc.RemoveAll
arrFiles.RemoveAll
ErrStr = "success"
'----------------- Delete Attachment
For Each f1 in fc
cf= c & "\" & f1.name
fso.DeleteFile cf
next
End If
On Error Goto 0 ' cancel On Error Resume Next

End If

Morgoth
05-13-2003, 03:25 AM
My suggestion to this, if there is no error, is to make sure your SMTP server works..
A good way is to get some simple code with a simple component, and check to see if that e-mail is sent.. (The simple coded one)