Hi,
I use the standard code given below to send an email from an ASP.NET
web form. The code executes fine but no Email is sent. All emails get
queued in the Inetpub mail queue.
I'm using my local default SMTP Server and my from address is a valid
Yahoo/Hotmail address. I have configures the local SMTP Server to allow
the IP Address 127.0.0.1.
Could this be because yahoo/hotmail servers need authentication?
Here's the code I use.
private void SendSimpleMail()
{
MailMessage objEmail = New MailMessage();
objEmail.From = "va******@yahoo.com";
objEmail.To = "an**************@hotmail.com";
objEmail.Subject = "Test Mail";
objEmail.Body = "Test Mail - Body";
SmtpMail.SmtpServer = "127.0.0.1";
SmtpMail.Send(objEmail);
}
Any idea what could be wrong or what I need to do to send a simple
email from ASP.NET? Any help would be appreaciated.
Regards,
supz 14 8856
"supz" <su****@yahoo.com> wrote in message
news:11*********************@t39g2000cwt.googlegro ups.com... Could this be because yahoo/hotmail servers need authentication? www.systemwebmail.com
You may have forgotton to set up your smart host settings in smtp under iis.
This tells IIS how to route the SMTP message, in effect who to pass it to
for onward delivery.
--
Regards
John Timney
Microsoft MVP
"supz" <su****@yahoo.com> wrote in message
news:11*********************@t39g2000cwt.googlegro ups.com... Hi,
I use the standard code given below to send an email from an ASP.NET web form. The code executes fine but no Email is sent. All emails get queued in the Inetpub mail queue.
I'm using my local default SMTP Server and my from address is a valid Yahoo/Hotmail address. I have configures the local SMTP Server to allow the IP Address 127.0.0.1.
Could this be because yahoo/hotmail servers need authentication?
Here's the code I use.
private void SendSimpleMail() {
MailMessage objEmail = New MailMessage(); objEmail.From = "va******@yahoo.com"; objEmail.To = "an**************@hotmail.com"; objEmail.Subject = "Test Mail"; objEmail.Body = "Test Mail - Body"; SmtpMail.SmtpServer = "127.0.0.1";
SmtpMail.Send(objEmail);
}
Any idea what could be wrong or what I need to do to send a simple email from ASP.NET? Any help would be appreaciated.
Regards, supz
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?
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" <su****@yahoo.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com... 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?
You can try to replace the smtp device
SmtpMail.SmtpServer = "mail.yahoo.co.uk";
It migth still fail though, yahoo probably requires a username and password
to forward mail through it and you might need to use a thrid party component http://www.aspnetemail.com/
or if your using .net 1.1 or above
private void Page_Load(object sender, System.EventArgs e)
{
MailMessage mail = new MailMessage();
mail.To = "me@mycompany.com";
mail.From = "yo*@yourcompany.com";
mail.Subject = "this is a test email.";
mail.Body = "Some text goes here";
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
"1"); //basic authentication
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",
"my_username_here"); //set your username here
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",
"super_secret"); //set your password here
SmtpMail.SmtpServer = "mail.mycompany.com"; //your real server goes here
SmtpMail.Send( mail );
}
taken from http://www.systemwebmail.com/faq/3.8.aspx
--
Regards
John Timney
Microsoft MVP
"supz" <su****@yahoo.com> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com... 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?
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" <no***********@nowhere.com> wrote in message
news:O7**************@TK2MSFTNGP09.phx.gbl... 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" <su****@yahoo.com> wrote in message news:11**********************@u72g2000cwu.googlegr oups.com... 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?
See my blog entry: http://spaces.msn.com/sholliday/
2/8/2006
Smarter Email/Smtp setup with DotNet Configuration Sections (1.1 and 2.0)
I have
No(authentication)
Basic
and
SSL
gmail is the example I use....you might want to get an gmail account and use
it,,if the yahoo keeps failing.
"supz" <su****@yahoo.com> wrote in message
news:11*********************@t39g2000cwt.googlegro ups.com... Hi,
I use the standard code given below to send an email from an ASP.NET web form. The code executes fine but no Email is sent. All emails get queued in the Inetpub mail queue.
I'm using my local default SMTP Server and my from address is a valid Yahoo/Hotmail address. I have configures the local SMTP Server to allow the IP Address 127.0.0.1.
Could this be because yahoo/hotmail servers need authentication?
Here's the code I use.
private void SendSimpleMail() {
MailMessage objEmail = New MailMessage(); objEmail.From = "va******@yahoo.com"; objEmail.To = "an**************@hotmail.com"; objEmail.Subject = "Test Mail"; objEmail.Body = "Test Mail - Body"; SmtpMail.SmtpServer = "127.0.0.1";
SmtpMail.Send(objEmail);
}
Any idea what could be wrong or what I need to do to send a simple email from ASP.NET? Any help would be appreaciated.
Regards, supz
PS
If you get the yahoo settings worked out...with my code from my blog.
Could you post a reply here...and a comment at the blog on which settings
you used.
Thanks...
"supz" <su****@yahoo.com> wrote in message
news:11*********************@t39g2000cwt.googlegro ups.com... Hi,
I use the standard code given below to send an email from an ASP.NET web form. The code executes fine but no Email is sent. All emails get queued in the Inetpub mail queue.
I'm using my local default SMTP Server and my from address is a valid Yahoo/Hotmail address. I have configures the local SMTP Server to allow the IP Address 127.0.0.1.
Could this be because yahoo/hotmail servers need authentication?
Here's the code I use.
private void SendSimpleMail() {
MailMessage objEmail = New MailMessage(); objEmail.From = "va******@yahoo.com"; objEmail.To = "an**************@hotmail.com"; objEmail.Subject = "Test Mail"; objEmail.Body = "Test Mail - Body"; SmtpMail.SmtpServer = "127.0.0.1";
SmtpMail.Send(objEmail);
}
Any idea what could be wrong or what I need to do to send a simple email from ASP.NET? Any help would be appreaciated.
Regards, supz
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" <km*@schneeberger.ch> wrote in message news:dt**********@atlas.ip-plus.net... 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" <no***********@nowhere.com> wrote in message news:O7**************@TK2MSFTNGP09.phx.gbl... 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" <su****@yahoo.com> wrote in message news:11**********************@u72g2000cwu.googlegr oups.com... 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?
Juan,
Thanks for the quick reply.
Just to clarify, *my* ASP.NET program has the recipient address hard coded
to me at co*********@mydomain.com, so no problem there. And of course anyone
can spam me through the contact form, or indeed simply by putting sa***@mydomain.com 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" <no***********@nowhere.com> wrote in message
news:OK**************@TK2MSFTNGP15.phx.gbl... 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" <km*@schneeberger.ch> wrote in message news:dt**********@atlas.ip-plus.net... 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" <no***********@nowhere.com> wrote in message news:O7**************@TK2MSFTNGP09.phx.gbl... 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" <su****@yahoo.com> wrote in message news:11**********************@u72g2000cwu.googlegr oups.com... 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?
re: 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.
Not really. See below.
re: 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?
Your SMTP server should have its "Relay Restrictions" set.
If you set the relay restrictions to only allow traffic from the same machine IP
as your smtp server, your smtp server can't be used by external spammers.
In the IIS Manager, after opening the smtp server's properties,
you'll find the "Relay Restrictions" dialog in the "Access" tab.
If you don't have access to the IIS Manager, ask your provider
about the Relay restrictions they have in place.
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" <km*@schneeberger.ch> wrote in message news:dt**********@atlas.ip-plus.net... Juan,
Thanks for the quick reply.
Just to clarify, *my* ASP.NET program has the recipient address hard coded to me at co*********@mydomain.com, so no problem there. And of course anyone can spam me through the contact form, or indeed simply by putting sa***@mydomain.com 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" <no***********@nowhere.com> wrote in message news:OK**************@TK2MSFTNGP15.phx.gbl... 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" <km*@schneeberger.ch> wrote in message news:dt**********@atlas.ip-plus.net... 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" <no***********@nowhere.com> wrote in message news:O7**************@TK2MSFTNGP09.phx.gbl... 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" <su****@yahoo.com> wrote in message news:11**********************@u72g2000cwu.googlegr oups.com... > 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? >
"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:uO**************@TK2MSFTNGP11.phx.gbl... re: 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. Not really. See below.
re: 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?
Your SMTP server should have its "Relay Restrictions" set.
If you set the relay restrictions to only allow traffic from the same machine IP as your smtp server, your smtp server can't be used by external spammers.
In the IIS Manager, after opening the smtp server's properties, you'll find the "Relay Restrictions" dialog in the "Access" tab.
If you don't have access to the IIS Manager, ask your provider about the Relay restrictions they have in place.
Thanks Juan.
I'm definitely going to do this. I could understand if I were unable to send
locally while testing. Hopefully the local test only works because I'm
already "hidden" logged in through my email client. I'll have to
investigate. Thanks for pointing me down the right road. At least I can
explain the problem to the shared host easier now. 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" <km*@schneeberger.ch> wrote in message news:dt**********@atlas.ip-plus.net... Juan,
Thanks for the quick reply.
Just to clarify, *my* ASP.NET program has the recipient address hard coded to me at co*********@mydomain.com, so no problem there. And of course anyone can spam me through the contact form, or indeed simply by putting sa***@mydomain.com 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" <no***********@nowhere.com> wrote in message news:OK**************@TK2MSFTNGP15.phx.gbl... 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" <km*@schneeberger.ch> wrote in message news:dt**********@atlas.ip-plus.net... 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" <no***********@nowhere.com> wrote in message news:O7**************@TK2MSFTNGP09.phx.gbl... > 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" <su****@yahoo.com> wrote in message > news:11**********************@u72g2000cwu.googlegr oups.com... >> 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? >> > >
Juan,
Just an update. It appears that, locally at least, I can only forward to
addresses in the same (my) domain. At least this puts my mind at rest
regarding people spamming others through me. I could still get loads of
spam, but then again I get loads anyway.
Cheers.
"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:uO**************@TK2MSFTNGP11.phx.gbl... re: 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.
Not really. See below.
re: 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?
Your SMTP server should have its "Relay Restrictions" set.
If you set the relay restrictions to only allow traffic from the same machine IP as your smtp server, your smtp server can't be used by external spammers.
In the IIS Manager, after opening the smtp server's properties, you'll find the "Relay Restrictions" dialog in the "Access" tab.
If you don't have access to the IIS Manager, ask your provider about the Relay restrictions they have in place.
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" <km*@schneeberger.ch> wrote in message news:dt**********@atlas.ip-plus.net... Juan,
Thanks for the quick reply.
Just to clarify, *my* ASP.NET program has the recipient address hard coded to me at co*********@mydomain.com, so no problem there. And of course anyone can spam me through the contact form, or indeed simply by putting sa***@mydomain.com 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" <no***********@nowhere.com> wrote in message news:OK**************@TK2MSFTNGP15.phx.gbl... 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" <km*@schneeberger.ch> wrote in message news:dt**********@atlas.ip-plus.net... 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" <no***********@nowhere.com> wrote in message news:O7**************@TK2MSFTNGP09.phx.gbl... > 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" <su****@yahoo.com> wrote in message > news:11**********************@u72g2000cwu.googlegr oups.com... >> 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? >> > >
hi all,
i am getting the same problem but in windows application (vb.net). whenever
i try to send email from em***@mydomain.com to so*********@mydomain.com it
works fine but if i change address TO field with valid yahoo / hotmail the
message going in the queue folder.
i am planning to develop an email sending application that sends GCC
investment oppertunies / GCC Market Review / Other Market Results to our
90,000 subscribers.
any suggestion would be greatly appricated :)
"supz" wrote: Hi,
I use the standard code given below to send an email from an ASP.NET web form. The code executes fine but no Email is sent. All emails get queued in the Inetpub mail queue.
I'm using my local default SMTP Server and my from address is a valid Yahoo/Hotmail address. I have configures the local SMTP Server to allow the IP Address 127.0.0.1.
Could this be because yahoo/hotmail servers need authentication?
Here's the code I use.
private void SendSimpleMail() {
MailMessage objEmail = New MailMessage(); objEmail.From = "va******@yahoo.com"; objEmail.To = "an**************@hotmail.com"; objEmail.Subject = "Test Mail"; objEmail.Body = "Test Mail - Body"; SmtpMail.SmtpServer = "127.0.0.1";
SmtpMail.Send(objEmail);
}
Any idea what could be wrong or what I need to do to send a simple email from ASP.NET? Any help would be appreaciated.
Regards, supz
This discussion thread is closed Replies have been disabled for this discussion. Similar topics
8 posts
views
Thread by Jason |
last post: by
|
2 posts
views
Thread by Leszek |
last post: by
|
6 posts
views
Thread by Cameron Eckman |
last post: by
|
5 posts
views
Thread by ElanKathir |
last post: by
|
2 posts
views
Thread by Edward |
last post: by
|
3 posts
views
Thread by Jens |
last post: by
|
2 posts
views
Thread by Wayne Wengert |
last post: by
|
19 posts
views
Thread by zdrakec |
last post: by
| | | | | | | | | | | |