Solved

Outlook Redemption

Posted on 2004-08-04
28
919 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
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

744 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now