ASP.NET SMTP mail never received

I

ibiza

Hi all,

I am trying to use the System.Net.Mail class for the first time, with
ASP.NET 2.0.

I setup everything according to
http://www.codeproject.com/aspnet/EasySMTP_package.asp, which gives me
a working environment for sending mails.

I am sure the code is correct, there are no errors and everything seems
to work fine. However, I never receive the email. I've done some
research before posting this, and I suspect it is never sent because I
use a totally random email for the Msg.From Attribute, which may be
wrong. I am under Windows XP, IIS 6.0, and I would like to know how am
I supposed to know what valid email can I put in the From ?? Is there a
way to add mail (forward only) addresses from which we can effectively
send emails, somewhere in IIS or anywhere else? How am I supposed to
know what email to use in the From, if I simply sent it from localhost
(no domain or anything, just my own computer)?

Any help on this would be much appreciated,
thanks in advance!
 
D

David Longnecker

A quick check would be to see if you're dropping your email messages at the
SMTP relay.

%systemdrive%\inetpub\mailroot\drop
%systemdrive%\inetpub\mailroot\badmail
%systemdrive%\inetpub\mailroot\queue

That'd help to narrow out if it's the code (if your message is being generated
and packaged OK) or the SMTP on your web server.

In the from field, it depends on your SMTP server. Our Exchange servers
are locked down and require you to have the same domain, so we use donotreply@{
our domain here }.com or something similar. You should be able to use your
own email address.

If you're curious about your code, have you tried using breakpoints in your
code and stepping through to make sure it hits each step?

-dl
 
I

ibiza

Thanks for quick reply :)

I've checked in all subfolders in %systemdrive%\inetpub\mailroot,
nothing there. Also, I've enabled tracing in IIS, to see if it would
give some hints, here's what it has generated when sending mail :
23:01:24 192.168.0.100 EHLO - 250
23:01:24 192.168.0.100 MAIL - 250
23:01:24 192.168.0.100 RCPT - 550
23:01:24 192.168.0.100 QUIT - 0

I haven't a clue of what that means...

For the From field, I am really no expert in terms of domains and all,
so that's why I suspect the problem is there...you say you use your
domain, but what's mine if I simply want to send an email from a
localhost IIS server, not attached to any domain? I tried to send from
my email, as you said, (which is a gmail.com address), and it still
doesn't send..

I stepped into my code line by line (it isn't that long), and
everything is executed normally, even the
MailObj.Send(Msg)

So, I really think it that 'domain' problem :\

thanks again!
 
S

sloan

In addition to the previous post

(inetpub/mail stuff)

you also want to make sure you specifying the correct "authentication".

Check this post:
2/8/2006
Smarter Email/Smtp setup with DotNet Configuration Sections (1.1 and 2.0)
http://sholliday.spaces.live.com/blog/


Try different email (recipient) combo's , because sometimes something like
hotmail will block an incoming email. That's probably not the issue, but I
mention it anyways.
 
I

ibiza

well, all setup in IIS should be fine.

Do you mean 'anonymous' as authentication (in IIS)?
 
S

sloan

No, the end smtp server sometimes need authentication.

Read the blog... will show more.


sometimes, like with dialup, you use "none" authentication.

sometimes , they want you to at least pass them your account id, and a
password.
(basic)

sometimes, they want a password, username and to use SSL (ssl
authentication)

It mimicks all the smtp settings you'd find under Outlook Express ...
 
I

ibiza

I made it to put the message in the
%systemdrive%\inetpub\mailroot\queue folder, but now, I can't tell it
is still in queue...I made the change to the Msg.To field ->
'donotreply@ibiza'
where ibiza is my domain name (computer name)

Any ideas why it's stocked in queue now?
 
J

Juan T. Llibre

re:
is still in queue...I made the change to the Msg.To field ->
'donotreply@ibiza'
where ibiza is my domain name (computer name)

How do you expect a message to be delivered if it doesn't have a valid "To" address ?
 
I

ibiza

well that's exactly what I want to know. How do I add valid emails to
my smtp server (setuped in IIS?), so I can send emails from those
emails.
 
J

Juan T. Llibre

Set the "From" field to a valid email address.

static void PlainText()
{
//create the mail message
MailMessage mail = new MailMessage();

//set the addresses
mail.From = new MailAddress("(e-mail address removed)");
mail.To.Add("(e-mail address removed)");

//set the content
mail.Subject = "This is an email";
mail.Body = "this is the body content of the email.";

//send the message
SmtpClient smtp = new SmtpClient("127.0.0.1");
smtp.Send(mail);
}

You won't be able to *receive* mails as replies to the emails you send,
unless you have a POP3 server which can receive mail sent to the "From"
email addresses you include in your emails, though.
 
D

David Longnecker

RCPT 550 is typically caused because the remote mail was rejected or the
address was unapproved or unfound by that domain. More information about
SMTP can be found at http://www.ietf.org/rfc/rfc2821.txt, though that gets
a bit off topic for this group.

I'm assuming you're using, as in the example, the built-in SMTP of IIS 6.0?
When you set that up, what relay did you set that to? Your ISP? From experience,
my ISP, Cox Communications, doesn't allow non *@cox.net addresses to be sent
from their SMTP servers.

If you can step through and the .Send method works in your code, I'd bet
your code is fine and it lies somewhere in your SMTP configuration.

-dl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top