Forum Moderators: open
My code:
set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromAddress= "name@domain.com"
Mailer.RemoteHost = "mail.example.com"
Mailer.AddRecipient "nickname", "name@domain.com"
if Mailer.SendMail then
Response.Write "Mail sent..."
else
Response.Write "Failure:" & Mailer.Response & ". "
end if
set Mailer = nothing
I get the following error message: Failure:503 5.5.1 Incorrect command sequence.
I would be grateful for solutions.
Please note:
1. I got the same error message even when I assigned the subject and bodyText.
2. Regarding the order of assigning the FromAddress, RemoteHost and AddRecipient fields, I tried all 6 possible orders, and got the same error message each time.
[edited by: tedster at 11:44 pm (utc) on Jan. 3, 2004]
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = "widgets-r-us"
Mailer.FromAddress= "joe@widgets.example.com"
Mailer.RemoteHost = "<your mailserver>"
Mailer.AddRecipient "John Smith", "jsmith@consumer.example.com"
Mailer.Subject = "Your widgets..."
Mailer.BodyText = "Your widgets order has been processed!"
If Mailer.SendMail then
Response.Write "Mail sent..."
Else
Response.Write "Mail send failure. Error was " & Mailer.Response
End If
Set Mailer = Nothing
- Tony
set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = Request.Form ("name")
Mailer.FromAddress= Request.Form("email")
Mailer.RemoteHost = "mail.mydomain.com"
Mailer.AddRecipient "My Name","myaddress@mydomain.com"
Mailer.Subject = "Forms Registration"
strMsgHeader = "Form Information Follows: " & vbCrLf
for i = 1 to Request.Form.Count
strMsgInfo = strMsgInfo & Request.Form.Key(i) & " - " & Request.Form.Item(i) & vbCrLf
next
strMsgFooter = vbCrLf & "End of form information"
Mailer.BodyText = strMsgHeader & strMsgInfo & strMsgFooter
Mailer.SendMail
set Mailer = nothing
This one just takes the form data and mails it to me.
If you look at my original post again
Yes, I saw what you said, but I can't see anything wrong in your syntax for the mailer. You didn't post the code for the body or subject, so it could be that syntax is not correct.
There could also be other VBscript errors in your code which cause it not to function.
Without looking at everything you wrote (please don't post the whole file here) we can only help you to a point.
set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromAddress= "name@domain.com"
Mailer.Subject = "hi"
Mailer.BodyText = "hi"
Mailer.RemoteHost = "mail.example.com"
Mailer.AddRecipient "nickname", "name@domain.com"
if Mailer.SendMail then
Response.Write "Mail sent..."
else
Response.Write "Failure:" & Mailer.Response & ". "
end if
set Mailer = nothing
(Just so you know, if the problem would have been my omitting the subject and/or bodyText, then the error message would have been different. I say this because when I had the exact same code as above but omitted the FromAddress field, I got a different error message, telling me that FromAddress is a required field.)