DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: send mail

  1. #1
    pal Guest

    send mail

    still in vbpj tech tips, 10th ed., there's a routine to send mail:

    ---BEG
    Private Sub cmdSendIt_Click()
    Dim sText As String
    Dim sAddedText As String
    If Len(txtMainAddresses) Then
    sText = txtMainAddresses
    End If
    If Len(txtCC) Then
    sAddedText = sAddedText & "&CC=" & txtCC
    End If
    If Len(txtBCC) Then
    sAddedText = sAddedText & "&BCC=" & txtBCC
    End If
    If Len(txtSubject) Then
    sAddedText = sAddedText & "&Subject=" & txtSubject
    End If
    If Len(txtBody) Then
    sAddedText = sAddedText & "&Body=" & txtBody
    End If
    If Len(txtAttachmentFileLocation) Then
    sAddedText = sAddedText & "&Attach=" & _
    Chr(34) & txtAttachmentFileLocation & Chr(34)
    End If
    sText = "mailto:" & sText
    ' clean the added elements
    If Len(sAddedText) <> 0 Then
    ' there are added elements, replace the first
    ' ampersand with the question character
    Mid$(sAddedText, 1, 1) = "?"
    End If
    sText = sText & sAddedText
    If Len(sText) Then
    Call ShellExecute(Me.hWnd, "open", sText, _
    vbNullString, vbNullString, SW_SHOWNORMAL)
    End If
    End Sub
    ----END

    a slightly straighter sample is in http://www.vb2themax.com

    the trouble is: i've tried many times, this way or the like, to attach
    something, always failing.
    i just cant get the &attach working, no way --

    is there a way to get that ?

    tia, pal
    --
    andrea dot palazzi at tin dot it
    free vb/sw: http://www.comune.modena.it/cittadini/apal/html/




  2. #2
    Karl E. Peterson Guest

    Re: send mail

    Hi Pal --

    >the trouble is: i've tried many times, this way or the like, to attach
    >something, always failing.
    >i just cant get the &attach working, no way --
    >
    >is there a way to get that ?


    That depends on the mail client. I don't think OE cuts it here. You need a fully
    Exchange-compliant client. Try the same code with (full) Outlook, and see if it
    doesn't work there.

    Later... Karl



    pal wrote in message <38d4261b@news.devx.com>...
    >still in vbpj tech tips, 10th ed., there's a routine to send mail:
    >
    >---BEG
    >Private Sub cmdSendIt_Click()
    >Dim sText As String
    >Dim sAddedText As String
    >If Len(txtMainAddresses) Then
    >sText = txtMainAddresses
    >End If
    >If Len(txtCC) Then
    >sAddedText = sAddedText & "&CC=" & txtCC
    >End If
    >If Len(txtBCC) Then
    >sAddedText = sAddedText & "&BCC=" & txtBCC
    >End If
    >If Len(txtSubject) Then
    >sAddedText = sAddedText & "&Subject=" & txtSubject
    >End If
    >If Len(txtBody) Then
    >sAddedText = sAddedText & "&Body=" & txtBody
    >End If
    >If Len(txtAttachmentFileLocation) Then
    >sAddedText = sAddedText & "&Attach=" & _
    >Chr(34) & txtAttachmentFileLocation & Chr(34)
    >End If
    >sText = "mailto:" & sText
    >' clean the added elements
    >If Len(sAddedText) <> 0 Then
    >' there are added elements, replace the first
    >' ampersand with the question character
    >Mid$(sAddedText, 1, 1) = "?"
    >End If
    >sText = sText & sAddedText
    >If Len(sText) Then
    >Call ShellExecute(Me.hWnd, "open", sText, _
    >vbNullString, vbNullString, SW_SHOWNORMAL)
    >End If
    >End Sub
    >----END
    >
    >a slightly straighter sample is in http://www.vb2themax.com
    >
    >the trouble is: i've tried many times, this way or the like, to attach
    >something, always failing.
    >i just cant get the &attach working, no way --
    >
    >is there a way to get that ?
    >
    >tia, pal
    >--
    >andrea dot palazzi at tin dot it
    >free vb/sw: http://www.comune.modena.it/cittadini/apal/html/
    >
    >
    >




  3. #3
    Steve Cochran Guest

    Re: send mail

    There's a nice free dll called Jmail that let's one do this regardless of
    mail client. All one needs is an SMTP server. Its very similar to CDONTS,
    but works in Win9x as well.

    http://tech.dimac.net

    steve

    "Karl E. Peterson" <karl@mvps.org> wrote in message
    news:38d6b134@news.devx.com...
    > Hi Pal --
    >
    > >the trouble is: i've tried many times, this way or the like, to attach
    > >something, always failing.
    > >i just cant get the &attach working, no way --
    > >
    > >is there a way to get that ?

    >
    > That depends on the mail client. I don't think OE cuts it here. You need

    a fully
    > Exchange-compliant client. Try the same code with (full) Outlook, and see

    if it
    > doesn't work there.
    >
    > Later... Karl
    >
    >
    >
    > pal wrote in message <38d4261b@news.devx.com>...
    > >still in vbpj tech tips, 10th ed., there's a routine to send mail:
    > >
    > >---BEG
    > >Private Sub cmdSendIt_Click()
    > >Dim sText As String
    > >Dim sAddedText As String
    > >If Len(txtMainAddresses) Then
    > >sText = txtMainAddresses
    > >End If
    > >If Len(txtCC) Then
    > >sAddedText = sAddedText & "&CC=" & txtCC
    > >End If
    > >If Len(txtBCC) Then
    > >sAddedText = sAddedText & "&BCC=" & txtBCC
    > >End If
    > >If Len(txtSubject) Then
    > >sAddedText = sAddedText & "&Subject=" & txtSubject
    > >End If
    > >If Len(txtBody) Then
    > >sAddedText = sAddedText & "&Body=" & txtBody
    > >End If
    > >If Len(txtAttachmentFileLocation) Then
    > >sAddedText = sAddedText & "&Attach=" & _
    > >Chr(34) & txtAttachmentFileLocation & Chr(34)
    > >End If
    > >sText = "mailto:" & sText
    > >' clean the added elements
    > >If Len(sAddedText) <> 0 Then
    > >' there are added elements, replace the first
    > >' ampersand with the question character
    > >Mid$(sAddedText, 1, 1) = "?"
    > >End If
    > >sText = sText & sAddedText
    > >If Len(sText) Then
    > >Call ShellExecute(Me.hWnd, "open", sText, _
    > >vbNullString, vbNullString, SW_SHOWNORMAL)
    > >End If
    > >End Sub
    > >----END
    > >
    > >a slightly straighter sample is in http://www.vb2themax.com
    > >
    > >the trouble is: i've tried many times, this way or the like, to attach
    > >something, always failing.
    > >i just cant get the &attach working, no way --
    > >
    > >is there a way to get that ?
    > >
    > >tia, pal
    > >--
    > >andrea dot palazzi at tin dot it
    > >free vb/sw: http://www.comune.modena.it/cittadini/apal/html/
    > >
    > >
    > >

    >
    >



  4. #4
    pal Guest

    Re: send mail

    thanks karl and steve, i'm trying both ways.
    francesco balena said to me there's an error in the mail protocol, anyway
    i'm wishing to try.
    for the sake of curiosity -- together wih laziness, my own best engine for
    programming...
    pal

    "Steve Cochran" <scochran@chattanooga.net> ha scritto
    > There's a nice free dll called Jmail that let's one do this regardless of
    > mail client. All one needs is an SMTP server. Its very similar to

    CDONTS,
    > but works in Win9x as well.
    > http://tech.dimac.net


    > "Karl E. Peterson" <karl@mvps.org> wrote in message
    > > Hi Pal --


    > > >the trouble is: i've tried many times, this way or the like, to attach
    > > >something, always failing.
    > > >i just cant get the &attach working, no way --
    > > >is there a way to get that ?


    > > That depends on the mail client. I don't think OE cuts it here. You

    need
    > a fully
    > > Exchange-compliant client. Try the same code with (full) Outlook, and

    see
    > if it
    > > doesn't work there.




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center