Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to do e-mail in .net?

Status
Not open for further replies.

bigfoot

Programmer
May 4, 1999
1,779
US
I searched this site and google. The studio docs talk about it, but I can't get the code to compile.
It uses System.Web>Mail but I'm not using asp.net, I'm using a windows application.
 
Sure:
Code:
Public Shared Sub EmailInfo(ByVal Message As String, _
                            ByVal Recipients As String, _
                            ByVal Sender As String)
  Dim objMail As New System.Web.Mail.MailMessage()

  ' Assemble Email.
  With objMail
    .To = Recipients
    .From = Sender
    .Subject = [b]Subject[/b]
    .Body = Message
    .BodyFormat = Web.Mail.MailFormat.Text
  End With
  System.Web.Mail.SmtpMail.SmtpServer = [b]ServerName[/b]
  System.Web.Mail.SmtpMail.Send(objMail)
End Sub

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Also check out the FAQ section here. I have learned that almost anything is possible using the .Net framework.
 
Thanks ThatRickGuy.

There is no System.Web.Mail object in windows .net. There is one in asp.net but this is a windows application.

I think they are going to use outlook instead of me writing a custom application to go with our software.

Things change by the minute here.. LOL
 
I think you just have to make a reference to

System.Web.dll

to make it work.

- - - - - - - - - - - - - - - - - -
Im three apples high, Im blue, and i most certainly like that cold beer that should be every mans right after a hard days work!
 
Drawbacks to this method include...
1) No history of mail sent. (ie Sent Items)
2) You still have to set up CDO on every Client machine.



Sweep
 
Yes...but Outlook can be a pain too. Especially the security measures, where every single mail send has to confirmed as allowable.

Two ways around this that I know of
1) Outlook Redemption
2) ClickYes (very handly task bar utility & comes with code that shows how to integrate into .Net)
admit nothing. [/b]
 
Squeakinsweep, how long do you consider it takes to write the code to save history(ie sent items)? 30 mins? I think one of your drawbacks doesnt really count ;)

- - - - - - - - - - - - - - - - - -
Im three apples high, Im blue, and i most certainly like that cold beer that should be every mans right after a hard days work!
 
how long do you consider it takes to write the code to save history(ie sent items)? 30 mins?
Sure you can save it easily, but where are you going to save it to. Lets say you use Outlook as your typical email client, then you're going to have 2 sources of sent mail. You try telling a typical user, that they will have to search 2 entirely different sources to find a previously sent mail. And if you're going to suggest saving it to your mail client, then you may as well go the whole hog (say another 30 mins?), and automate/integrate into your existing mail client.



Sweep
...if it works dont f*** with it
...if its f****ed blame someone else
...if its your fault that its f***ed, say and admit nothing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top