Are you specifying the mail object’s SMTPServer property = “localhost” ? If there is a restriction, it should be listed somewhere on jodohost’s site.
-Dave
Actually you do not have to specify your SMTP server, just leave it as is (default). All you have to do is to put an existing mail account to From field of mail message. At least it works fine for me.
Oh yeah, that’s a common mistake – make sure the FROM address is valid. Plenty of times there is a silly invalid character or something like that in the FROM field and people miss it. The SMTP server will choke on it. Good catch, Patrick.
By the way – did you catch the bug in the mail object with respect to permissions? Try sending a file attachment larger than about 100k. If it fails, but works for smaller attachments, that’s the bug. The installation software didn’t set full permissions in some weird directory like c:\documents and settings\dotnet<machine name><account name>\local
settings\temp or something like that. I think one of the SP will fix it though…
-Dave
Mine, although done in VB, is pretty much the same (apart from some stuff for testing and error handling) and works like a charm for me.
Public Function SendEmail(ByVal FromEmail As String, ByVal ToEmail As String, ByVal Subject As String, ByVal Message As String) As Boolean
Dim ReturnValue As Boolean
Dim objMail As System.Web.Mail.SmtpMail
Dim objMsg As System.Web.Mail.MailMessage
objMsg = New Web.Mail.MailMessage()
objMsg.From = FromEmail
objMsg.To = ToEmail
objMsg.Subject = Subject
objMsg.Body = Message
objMsg.BodyFormat = MailFormat.Html
#If Debug Then
ReturnValue = True
#Else
Try
objMail.Send(objMsg)
ReturnValue = True
Catch ex As Exception
Response.AppendToLog("Email error:" & ex.Message)
ReturnValue = False
End Try
#End If
Return ReturnValue
End Function
Better yet do as reseller support article number 9 says:
Problem:
Why am I not able to send email from my ASP, PHP, CGI or .NET script to AOL email addresses?
Solution:
This is because AOL requires each sending IP address to have a reverse DNS record. When sending an email from your script and using “localhost” as your mailserver host name, email will be sent from the web server’s default SMTP server which doesn’t have a rDNS record. You are requested instead to send email through our regular email server by specifying mail.yourdomain.com as your mailserver hostname. You will need to perform SMTP authentication to send email via the regular mailserver and hence you must enter the username and password for the email address from which the emails would be sent.
[QUOTE=gsc4]
You will need to perform SMTP authentication to send email via the regular mailserver and hence you must enter the username and password for the email address from which the emails would be sent.
[/QUOTE]
What if the “from” address is an email forwarding account with no username/password?