Apparently you are running an SMTP server on your FoxWeb PC (probably IIS SMTP server), but it is not configured to relay email. Your script would probably work if you set mySmartMail.Server to "localhost", but you may also have to modify the IIS configuration. Alternatively you can use your regular SMTP server (the one that you are using to send email from your email client application).
Sent by Larry Zhang on 12/27/2005 08:52:59 AM:
I tried to use ASPSmartMail to send email. But hit an error on the recipients.add line:
OLE IDispatch exception code 0 from aspSmartMail.SendMail : Error 40: Error when check Recipient address : 550 5.7.1 Unable to relay for firstname.lastname@example.org ..
Is it because I did not install ASPSmartMail control? If so, where should I get the control? Thank you.
mySmartMail.Server = "NJ-LZHANG.xyz.com" && my PC name
mySmartMail.SenderName = "My Name"
mySmartMail.SenderAddress = "email@example.com" && my default company email address
mySmartMail.Recipients.Add("firstname.lastname@example.org", "Friend's name") && error on this line
mySmartMail.Subject = "aspSmartMail Sample 1"
mySmartMail.Body = "This mail has been sent with aspSmartMail."
SendFailed = .F.
OldErr = ON("ERROR")
ON ERROR SendFailed = .T.
ON ERROR &OldErr
Response.write("Failed to send e-mail. The error message was:<br>" +MESSAGE())
Response.write("An e-mail has just been sent to " + mySmartMail.Recipients.Item(1).Name)