Mail Problem from ASP.NET

coreo

Guppy
Hi,

I'm developing an application in ASP.NET which involves the sending of email via the SMTP server mail.myaccount.com.

When it tries to send the email, I get an error:

The server rejected one or more recipient addresses. The server response was: 553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1)

Is there some restriction on mail sending through the SMTP server?

Thanks,
Cameron.
 
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
 
And now it's working again. I haven't changed a thing. Must have been something funny going on somewhere!
 
Hmm... then let's see what different in my code and yours. Here is what I use to send e-mail from ASP.NET (C#)
Code:
MailMessage mail = new MailMessage();
mail.To = To;
mail.From = From;
mail.Subject = Subject;
mail.Priority = Priority;
mail.Headers["Reply-To"] = ReplyTo;
mail.BodyFormat = MailFormat.Text;
mail.Body = TextBody;
SmtpMail.Send(mail);
 
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.

Code:
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

Hope this helps...
 
This was my code that worked, stopped working, but now works:

System.Web.Mail.MailMessage Mail1 = new System.Web.Mail.MailMessage();
Mail1.From = "[email protected]";
Mail1.To = txtEmail.Text;
Mail1.Subject = "Subject";
Mail1.Body = "Body";
System.Web.Mail.SmtpMail.Send(Mail1);


It wasn't a coding problem. It was a server problem that has now been fixed.
 
HI did you figure this out?
What is the SMTP Server address we need to use to send from ASP.NET.
Does it require authentication?
Thanks,
Rog
 
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.
 
gsc4 said:
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.

What if the "from" address is an email forwarding account with no username/password?
 
Back
Top