Solved

Outlook Redemption

Posted on 2004-08-04
28
926 Views
Last Modified: 2008-02-01
Has anyone seccussfully used this with ASP.NET??  If so, can you please post the code as I'm having trouble getting it working.

Please don't bother posting links to the Redemption site.

Cheers
0
Comment
Question by:Poidda
  • 10
  • 9
  • 7
28 Comments
 
LVL 9

Expert Comment

by:crescendo
ID: 11721374
I've used it in VB6. Personally I think it's a bit of a pig's ear, just to get round an unneccessary obstacle, but hey, you have to do what you have to do.

What problems are you having? Post some code and I'll see if I can help.
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11722007
I agree state your desired functionality, why do you need this particular app?
0
 
LVL 1

Author Comment

by:Poidda
ID: 11726123
All I want to do is send an email when someone clicks a button in an ASP.NET application.  I have also done this in VB6 and it works fine.  However, I don't know the syntax for ASP.NET, and the VB6 code doesn't work from step one.
0
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
LVL 17

Expert Comment

by:AerosSaga
ID: 11726288
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
try
Dim objEmailMessage As System.Web.Mail.MailMessage
Dim objSMTPServer As System.Web.Mail.SmtpMail
objSMTPServer.SmtpServer = "mycomputername"
objEmailMessage = New System.Web.Mail.MailMessage
With objEmailMessage
.To = "destinationemail@address.com"
.From = txtFrom.Text
.Subject = "Great Job!"
.Body = "Want all my money?"
.BodyFormat = MailFormat.Html
End With
objSMTPServer.Send(objEmailMessage)
catch exc as exception
response.write(exc.innerexception.innerexception.message)
end try
End Sub
____________________________________________________________________________________________
Or
_____________________________________________________________________________________________

Private Sub Page_Load(sender As Object, e As System.EventArgs)
   Dim mail As New MailMessage()
   mail.To = "me@mycompany.com"
   mail.From = "you@yourcompany.com"
   mail.Subject = "this is a test email."
   mail.BodyFormat = MailFormat.Text
   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)
End Sub 'Page_Load

There ya go:

Regards,

Aeros
0
 
LVL 9

Expert Comment

by:crescendo
ID: 11726313
Why use Outlook? Why not use the built-in SMTP mail facility?

            Dim Msg As MailMessage = New System.Web.Mail.MailMessage

            Msg.Subject = "Your subject line"
            Msg.To = "someone@somedomain.com"
            Msg.From = "you@yourdomain.com"
            Msg.Body = £The body of the message"

                SmtpMail.SmtpServer = "localhost"
                SmtpMail.Send(Msg)
 
0
 
LVL 1

Author Comment

by:Poidda
ID: 11727656
Thanks all for you help, but I need to use the outlook object as i need to set the ReceiptRequested property, as it's critical to know if the recipient has read the email.

Peter
0
 
LVL 9

Expert Comment

by:crescendo
ID: 11727725
And presumably you need to read mail too, to view the receipts.

OK, going back to Redemption, what problems are you having?
0
 
LVL 1

Author Comment

by:Poidda
ID: 11728146
yeah i will read the receipt eventually.  The problem is I can't find an example of code anywhere, and the vb doesn't work.  
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11728271
0
 
LVL 1

Author Comment

by:Poidda
ID: 11728601
Thanks AeroSaga.  But did you get this working without the annoying popup box?
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11728680
I use this program to take care of that:

http://www.contextmagic.com/express-clickyes/

Regards,

Aeros
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11728696
be sure to read the entire page very thourghly ;)
0
 
LVL 9

Expert Comment

by:crescendo
ID: 11728733
Poidda:

You should be able to ask for a delivery receipt by adding a header, like

            Msg.Headers.Add("Return-Receipt-To", "me@mydomain.com")

but - and this applies to all mail servers - the recipients' server has to be configured to acknowledge the request. Try it and see if you get a receipt. Make sure you specify your own email address.

0
 
LVL 9

Expert Comment

by:crescendo
ID: 11728745
That was using the standard ASP.NET system.web.mail of course!
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11728810
0
 
LVL 1

Author Comment

by:Poidda
ID: 11730405
thanks crescendo, but unfortunately that ddin't work.


    Sub SendEmail()
        Dim oMsg As New Mail.MailMessage()

        oMsg.From = "peter.harman@maplesandcalder.com"
        oMsg.To = "KYCDEV@maplesandcalder.com"
        oMsg.Subject = "test"
        oMsg.Body = "blah blah blah"
        oMsg.Headers.Add("Return-Receipt-Return", "peter.harman@maplesandcalder.com")

        SmtpMail.SmtpServer = "kyexc02"

        SmtpMail.Send(oMsg)

        oMsg = Nothing
    End Sub
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11730510
!!!the source code you desire can be found by following the link I posted

Regads,

Aeros
0
 
LVL 1

Author Comment

by:Poidda
ID: 11730713
sorry.  which link of the 3?  you know how it is when all people do is post links back.  I've looked at 100 links trying to get this working with no success.

Peter
0
 
LVL 9

Expert Comment

by:crescendo
ID: 11730740
Do you get a receipt from that address if you use Outlook?

I tried a few addresses and couldn't get a receipt via Outlook, so it was difficult to test. A lot of mail servers don't honour these requests so it's not a reliable method of knowing an email was delivered, whether you use ASP.NET, Outlook or whatever.

0
 
LVL 1

Author Comment

by:Poidda
ID: 11730756
no, no luck using Mail.MailMessage().  i can do all i want with the outlook object except for the annoying popup message that is unacceptable for the application.
0
 
LVL 1

Author Comment

by:Poidda
ID: 11730789
and yeah.  it's an internal project using outlook 2003 with exchange.
0
 
LVL 17

Accepted Solution

by:
AerosSaga earned 500 total points
ID: 11730942
Imports System.Runtime.InteropServices
Public Class Win32
' Declare Windows' API functions
Declare Auto Function RegisterWindowMessage Lib "user32.dll" _
        (ByVal lpString As String) As Integer

Declare Auto Function FindWindow Lib "user32.dll" _
        (ByVal lpClassName As String, _
        ByVal lpWindowName As String) As Integer

Declare Auto Function SendMessage Lib "user32.dll" _
        (ByVal hwnd As Integer, ByVal wMsg As Integer, _
        ByVal wParam As Integer, ByVal lParam As Integer) As Integer

Declare Auto Function IsWindow Lib "user32.dll" _
        (ByVal hwnd As Integer) As Boolean

End Class

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  Dim wnd As Integer
  Dim uClickYes As Integer
  Dim Res As Integer

' Register a message to send
  uClickYes = Win32.RegisterWindowMessage("CLICKYES_SUSPEND_RESUME")

' Find ClickYes Window by classname
  wnd = Win32.FindWindow("EXCLICKYES_WND", "Express ClickYes 1.0.2") 'System.String.Empty

' Send the message to Resume ClickYes
  If Win32.IsWindow(wnd) Then
    Res = Win32.SendMessage(wnd, uClickYes, 1, 0)
    MessageBox.Show("Resume Message Was Sent")
  End If

' ...
'   Do some Actions
' ...

' Send the message to Suspend ClickYes
  If Win32.IsWindow(wnd) Then
    Res = Win32.SendMessage(wnd, uClickYes, 0, 0)
    MessageBox.Show("Suspend Message Was Sent")
  End If

  End Sub

sorry I didn't specify which link, I posted the code here for you this time

Regards,

Aeros
0
 
LVL 1

Author Comment

by:Poidda
ID: 11731023
Thanks Auros,  I did see it done this way, but it is a bit of a hack.  I was hoping we could do it a bit better.  Sorry if I'm being picky, but I just don't agree with doing hacks as a short cut.  This is such a common function it should be simple.  I do have our Exchange "gurus" trying to suss it from that end.  FYI http://www.slipstick.com/outlook/esecup/admin.htm
0
 
LVL 9

Expert Comment

by:crescendo
ID: 11731142
Aeros:

I'm not sure that code will work with ASP.NET. It's Windows Forms code, not Web Forms. Have you tried it in ASP.NET?

Poidda:

I agree that an admin solution is better. Sometimes it's harder to get, though. : )

Good luck.
0
 
LVL 1

Author Comment

by:Poidda
ID: 11739712
tell me about it.  am working on it though.
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11740056
No problem crescendo, I understand wanting an actual solution as apossed to a workaround, just wanted to make sure you were aware of all your options.

Regards,

Aeros
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question