469,621 Members | 1,733 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,621 developers. It's quick & easy.

Sending emails through Asp.net

I need to send order confirmation emails through my asp.net
storefront. With my Asp 3.0 sites I use cdonts with no issues. I've
researched the system.web.mail asp.net way and haven't got it to work.
It boils down to the online smtp server declaration. I say a
solution to active relay on the mail server but in the next sentence
it said doing this may open your server up to spam relays. Not what I
want to do. I've tried using cdonts with asp.net and actually was
surprised to see it work offline while I was testing on my machine.
When I tried it online I got an exception. Any thoughts on this? I
even tried to use server.transfer("old asp3.0 email script") to
trigger the email but also received an exception.
Nov 18 '05 #1
1 1507
Mark,

Although I'm no expert on this subject I don't see how using the built in
System.Web.Mail class could ever "open up for relaying spam". The mail class
and your SMTP server has absolutely nothing to do with eachother other than
an occasional handshake whenever you are trying to send a mail.

MailMessage m = new MailMessage();
m.Subject = "Hello world";
m.From= "my*****@email.com";
m.To = "yo*******@email.com";
m.Body = "This is just a test";
SmtpMail.SmtpServer = "localhost"; //or whatever SMTP server that normally
allows you to relay (could be your ISPs)
SmtpMail.Send(m);

What happens here is simply that the Send method of SmtpMail class connects
to the specified SMTP server and sends the mail!

This is a transcript of what's going on when sending a mail:
HELO localhost //Function handshakes with SMTP-server
250 locahost Hello localhost // Server responds
mail from: my*****@email.com //function sends sender email
250 Sender OK //Server accepts
rcpt to: yo*******@email.com //function sends recipients email
250 Recipient OK. Will forward //Server accepts (OR denies!!)
data //Starting actual body and subject
subject: "Hello world"

This is just a test
. //the dot tells the smtp server that message is completed
250 Message accepted for delivery //Server accepts and sends!
I don't see any reasons why all of a sudden your SMTP server should be open
for spammers. This can only be changed by a setting inside your Mailserver,
and not by .Net itself unless you are able to code directly to your mail
server!

If anyone else has another (or better) explanation, please disregard this
one! ;)

Hope that it helps,

Thomas Regin.
"mark" <ma**@barkerspecialty.com> wrote in message
news:f3**************************@posting.google.c om... I need to send order confirmation emails through my asp.net
storefront. With my Asp 3.0 sites I use cdonts with no issues. I've
researched the system.web.mail asp.net way and haven't got it to work.
It boils down to the online smtp server declaration. I say a
solution to active relay on the mail server but in the next sentence
it said doing this may open your server up to spam relays. Not what I
want to do. I've tried using cdonts with asp.net and actually was
surprised to see it work offline while I was testing on my machine.
When I tried it online I got an exception. Any thoughts on this? I
even tried to use server.transfer("old asp3.0 email script") to
trigger the email but also received an exception.

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by dan glenn | last post: by
10 posts views Thread by Stuart Mueller | last post: by
1 post views Thread by Ian Taylor | last post: by
3 posts views Thread by VB Programmer | last post: by
2 posts views Thread by Mr. x | last post: by
3 posts views Thread by Ant | last post: by
5 posts views Thread by Kun | last post: by
1 post views Thread by robbiesmith79 | last post: by
2 posts views Thread by lstanikmas | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.