I have a page which processes ecards. Users fill in a form, and the data gets loaded into a db, and recipients get emailed to say they've got the ecard.
However in about 25% of cases, the user does not get the ecard.
My host uses ServerObject's ASPMail. The script that send the email out is at the end of the process.asp page after the </HTML> tag, and this is what it looks like:
PHP Code:
BODY = "Test line"
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = from_name
Mailer.FromAddress= from_email
Mailer.RemoteHost = "smtp.jimpix.co.uk"
Mailer.AddRecipient to_name, to_email
Mailer.Subject = "ecard sent..."
Mailer.BodyText = body
if Mailer.SendMail then
Response.Write " "
else
err = "INSERT INTO j_ecard_err (fldDate, errorDesc, cardID) VALUES (now(), '"&Mailer.Response&"',"&maxID&")"
set errRS = oConn.Execute(err)
'Response.Write "Mail send failure. Error was " & Mailer.Response
end if
Set Mailer = nothing
The code says php above, but it is ASP, that's just for the formatting...
There are no loops or reponse.redirects above the code, which would mean that at some point the page might redirect to another page, it should just run from top to bottom without a problem. I have tried for a while to BCC the email to myself, but they don't come through all the time either, so something is going wrong.
e.g. Today 20 ecards were sent from the site, but I only got 15 BCC emails. So I presume if I didn't get the email neither did the person the ecard was destined for.
I've set the code to write the code to a db if it doesn't work, but for some reason this db is still empty, so even though the email code isn't executed, it's not I presume because it's erroring, otherwise it'd be added to the database.
The rest of the ASP code to enter the data into the database does not error out either. I've tested the page myself a number of times and it runs fine. I don't use 'on error resume next' or any error trapping on any other part of the page, so if it was going to error I'd get an error message. Instead it seems to run fine, but sometimes the email does not get sent.
I've attached the process.asp file in case anyone needs / wants to see the rest of the code.
And ideas?
Thanks
Jim