• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 937
  • Last Modified:

Outlook Redemption

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
Poidda
Asked:
Poidda
  • 10
  • 9
  • 7
1 Solution
 
crescendoCommented:
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
 
AerosSagaCommented:
I agree state your desired functionality, why do you need this particular app?
0
 
PoiddaAuthor Commented:
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
AerosSagaCommented:
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
 
crescendoCommented:
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
 
PoiddaAuthor Commented:
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
 
crescendoCommented:
And presumably you need to read mail too, to view the receipts.

OK, going back to Redemption, what problems are you having?
0
 
PoiddaAuthor Commented:
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
 
PoiddaAuthor Commented:
Thanks AeroSaga.  But did you get this working without the annoying popup box?
0
 
AerosSagaCommented:
I use this program to take care of that:

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

Regards,

Aeros
0
 
AerosSagaCommented:
be sure to read the entire page very thourghly ;)
0
 
crescendoCommented:
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
 
crescendoCommented:
That was using the standard ASP.NET system.web.mail of course!
0
 
AerosSagaCommented:
0
 
PoiddaAuthor Commented:
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
 
AerosSagaCommented:
!!!the source code you desire can be found by following the link I posted

Regads,

Aeros
0
 
PoiddaAuthor Commented:
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
 
crescendoCommented:
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
 
PoiddaAuthor Commented:
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
 
PoiddaAuthor Commented:
and yeah.  it's an internal project using outlook 2003 with exchange.
0
 
AerosSagaCommented:
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
 
PoiddaAuthor Commented:
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
 
crescendoCommented:
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
 
PoiddaAuthor Commented:
tell me about it.  am working on it though.
0
 
AerosSagaCommented:
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

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 10
  • 9
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now