Your basic idea is right, though your syntax is off.  You've embedded
a function declaration in If..then block.  Also Yuo probably want to
send you mail when the user posts back to the form, not when they view
the page (you won't know who they are).

I'd so something like this...
 Sub Page_Load()

If Page.IsPostBack then
   If Login(username, pwd) = true then
     SendMail(your parms here )
   End if
End if
End Sub

  Public Function SendMail (By Val [To] As String
         ByVal Body As String, ByVal IsHTML As Boolean, _
         Optional ByVal SmtpServer As String = "domain.com") As
Boolean
         Try
            Dim objMsg As New System.Web.Mail.MailMessage()
            SendMail = True
            With objMsg
                .To = [To]
                .From = From
                .Subject = Subject
                .Body = Body
                       .BodyFormat = IIf(IsHTML = False, _
            System.Web.Mail.MailFormat.Html, _
            System.Web.Mail.MailFormat.Text)
       End With
       System.Web.Mail.SmtpMail.SmtpServer = SmtpServer
       System.Web.Mail.SmtpMail.Send(objMsg)
   Catch
       SendMail = False
   End Try
End Function


On 11/7/05, jgramins1 <[EMAIL PROTECTED]> wrote:
> Well...I left this out, sorry...
>
> The people accessing the given page will already in the site's
> database, so that is where their email addresses and clientID will
> be pulled from. All the session variable will be carrying is the
> clientID so as to identify them for the content of the page.
>
> Am I even close with the bit of code I posted or am I somewhere out
> in limbo?
>
> Thanks,
>
> Jeff
>
>
> --- In [email protected], Ryan Olshan
> <[EMAIL PROTECTED]> wrote:
> >
> > You should store that info about the customer in session variables
> and then
> > reference the session variables where you need them.
> >  /ryan
> >
> >  On 11/7/05, jgramins1 <[EMAIL PROTECTED]> wrote:
> > >
> > > Hello,
> > >
> > > I would like to set up a page so that when a client logs in to
> it it
> > > will automatically send me an email alert to tell me that they
> have
> > > viewed it.
> > >
> > > The "To" field would remain static (my email address), but
> > > the "From" needs to be the customer's email, the "Subject" line
> > > needs to contain the ClientID and the "Body" needs to contain the
> > > date and time the page was viewed.
> > >
> > > I cannot find how to do this anywhere on the web, so that is why
> I
> > > am asking here.
> > >
> > > I was wondering if it would go like:
> > >
> > > Sub Page_Load()
> > > If Not Page.IsPostBack Then
> > > Public Function SendMail (By Val [To] As String
> > > ByVal Body As String, ByVal IsHTML As Boolean, _
> > > Optional ByVal SmtpServer As String = "domain.com
> <http://domain.com/>")
> > > As
> > > Boolean
> > > Try
> > > Dim objMsg As New System.Web.Mail.MailMessage()
> > > SendMail = True
> > > With objMsg
> > > .To = [To]
> > > .From = From
> > > .Subject = Subject
> > > .Body = Body
> > > .BodyFormat = IIf(IsHTML = False, _
> > > System.Web.Mail.MailFormat.Html, _
> > > System.Web.Mail.MailFormat.Text)
> > > End With
> > > System.Web.Mail.SmtpMail.SmtpServer = SmtpServer
> > > System.Web.Mail.SmtpMail.Send(objMsg)
> > > Catch
> > > SendMail = False
> > > End Try
> > > End Function
> > > End If
> > > End Sub
> > >
> > > Thanks
> > >
> > > Jeff
> > >
> > >
> > >
> > >
> > >
> > >
> > >  ------------------------------
> > > YAHOO! GROUPS LINKS
> > >
> > >
> > >    - Visit your
> group "AspNetAnyQuestionIsOk<http://groups.yahoo.com/group/AspNetAnyQ
> uestionIsOk>"
> > >    on the web.
> > >     - To unsubscribe from this group, send an email to:
> > >    AspNetAnyQuestionIsOk-
> [EMAIL PROTECTED]<AspNetAnyQuestionIsOk-
> [EMAIL PROTECTED]>
> > >     - Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> > >    Service <http://docs.yahoo.com/info/terms/>.
> > >
> > >
> > >  ------------------------------
> > >
> >
> >
> > [Non-text portions of this message have been removed]
> >
>
>
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>


--
Dean Fiala
Very Practical Software, Inc
http://www.vpsw.com


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to