Re: SmtpMail.Send() No Error but no Email either.

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Juan,

Thanks for the quick reply.

Just to clarify, *my* ASP.NET program has the recipient address hard coded
to me at contactform@xxxxxxxxxxxx, so no problem there. And of course anyone
can spam me through the contact form, or indeed simply by putting
sales@xxxxxxxxxxxx etc. This much is clear and unavoidable.

But, from what I can tell, if *you* wrote a test ASP.NET app, and copied and
pasted my code from my project (or even if you knew the domain) then you
could spam whoever you want through my shared hosts SMTP server. The problem
is I can't find where the security is set. Surely they don't just leave this
kind of hole open, do they?

Hopefully I've explained myself better now.

Thanks for the quick reply.

"Juan T. Llibre" <nomailreplies@xxxxxxxxxxx> wrote in message
news:OKhkBz6OGHA.2628@xxxxxxxxxxxxxxxxxxxxxxx
re:
I'm worrying that anybody could send mail

In fact, anybody who can view that page will be able to send mail to you.

If you've hard-coded the address you need not worry,
except for the occasional spambot which will send you spam.

If you haven't hard-coded the address
( if you use a textbox for the user to write in the email address )
then anybody could send an email to anybody else, and you could
be the victim of an automated spam-sending scheme.




Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"KMA" <kma@xxxxxxxxxxxxxxx> wrote in message
news:dtv287$6vq$1@xxxxxxxxxxxxxxxxxxxx
Juan,

Can you explain this a bit more.

I've just made a contact page for my site to allow people to write a
message. Then the site sends the message via email to my private address.
Now, it all works fine, but I've got a nagging feeling because it works
from both my local test machine and the shared host. But I never specify
any password, and I'm worrying that anybody could send mail. since I'm on
shared hosting I don't get access to IIS. I thought at first that it
would only work on the host (some kind of permission for the ASP.NET
worker process) but it works local too. I'm worried. What can I do?

BTW the code is lifted straight from many examples from the web and is
almost identical to what you've posted below. (1.1 version).

Thankyou.


"Juan T. Llibre" <nomailreplies@xxxxxxxxxxx> wrote in message
news:O7X3Ns5OGHA.1312@xxxxxxxxxxxxxxxxxxxxxxx
re:
If I send using a "yahoo" address in the "from" field,
is it the responsibilty of the Yahoo server to deliver the mail?

No, it is not.
The mail will be delivered to the "TO:" address by your SMTP server.

re:
do I really need to set up the smart host settings?

You don't have to use a smart host, although sometimes it's better to
use one.
Not all the time, though.

re:
I read somewhere that the local SMTP server sends the mail
to the relay server which will send the email to the recipient.

Only if you use an external SMPT server.
If you use your own smtp server, *it* will send the mail.

The thing is that you must configure your smtp server so it:

1. can be found by the .Net Framework
2. allows mail relay only from certain IPs or machines.
Otherwise, anyubody can use *your* smtp server to send *their* mail.
Spammers would love it if you opened your smtp server so the could send
their spam.

Have you set the "Connection control" and "Relay Restrictions" ?
( in the "Access" tab...after opening the smtp server's properties in
the IIS Manager ).

This is extremely important.

They should be *both* set to your IP address.

Also, in the "Delivery" tab, in the "Advanced" button,
you can, optionally, set the domain name, if you have one.

Then, in your code, assign your machine name or domain name to the smtp
client :

For ASP.NET 2.0 :
Dim client As New SmtpClient("yourmachinename")
client.Send(mail)

For ASP.NET 1.1 :
System.Web.Mail.SmtpMail.SmtpServer = "your machine name or your domain
name"
System.Web.Mail.SmtpMail.Send(mail)



Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"supz" <supz_s@xxxxxxxxx> wrote in message
news:1141041359.202659.164960@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Thanks for your prompt replies. This might be a stupid quuestion, but
do I really need to set up the smart host settings? I read somewhere
that the local SMTP server sends the mail to the relay server which
will send the email to the recipient. If I send using a "yahoo" address
in the "from" field, is it the responsibilty of the Yahoo server to
deliver the mail?









.


Quantcast