Send an message with an HTML form...


  • Hi all,

    I'm trying to send a HTML form via email in a VBA app...

    I use to send HTML body messages without a problem, but now I'm need to send a form...

    Doesn't work. Of course I'm very newbie in HTM, and I'vd adapted from something I'vd foun in the net... :(

    Here is my code, and the HTML that I use into the variable KORPO:

    Public Function qINCIDENT(DESTINO As String, AXXUNTO As String, KORPO As String, Optional ZCC As String) As String
     Dim sdoMsg As CDO.Message
     Dim sdoConfig As CDO.Configuration
     Dim sdoFields As ADODB.Fields
     Dim nn As Long
     ''On Error GoTo ERROT
     QINCIDENT = "*"
     Set sdoMsg = New CDO.Message
     Set sdoConfig = New CDO.Configuration
     Set sdoFields = sdoConfig.Fields
     With sdoFields
      .Item(cdoSendUsingMethod) = cdoSendUsingPort
      .Item(cdoSMTPServer) = "mail.mail"
    '  .Item(cdoSMTPAuthenticate) = 1
      .Item(cdoSMTPConnectionTimeout) = 180
      .Item(cdoSaveSentItems) = True
     End With
     With sdoMsg
      Set .Configuration = sdoConfig
      ''''''''' receptor dos recibos
      .Fields(cdoDispositionNotificationTo) = ""
      .Fields(cdoReturnReceiptTo) = ""
      .Fields(cdoReturnPath) = ""   
      .DSNOptions = cdoDSNDefault
      .MDNRequested = True
      .From = ""
      .To = DESTINO
      If ZCC <> "" Then .CC = ZCC
      .Subject = AXXUNTO
      If InStr(KORPO, "html") > 0 Or InStr(KORPO, "HTML") > 0 Then
       .HTMLBody = KORPO 'already has the html within
       .TextBody = KORPO
      End If
     End With
     Set sdoMsg = Nothing
     Set sdoConfig = Nothing
     Set sdoFields = Nothing
     qINCIDENT = "OK"
     Exit Function
     MsgBox "Error IN SENDING : " + vbLf + CStr(Err.Number) + Err.Description, vbCritical
    End Function

    The HTML:

    <!doctype html>
        <meta charset="utf-8">
      <h1>Response Form</h1> 
    <form action="" method="get" enctype="text/plain">
      Cliente: <b>"JOSE DOS ANZOIS"</b>
      Please give the folow information about incident: <br />
      <select id="rating"><br />
    	<option>Partial Resolved</option>
        <option>In motion</option>
        <option>Waiting for solution</option>
        <option>Without solution</option>
        <option selected>Resolved</option>
      Comments<br />
      <textarea id="improve" rows="5" cols="50"></textarea>
      <input type="submit" value="Send"> <input type="Clear">

    Can someone give me some hint's or ... to forget it... :(









    Tuesday, November 01, 2011 6:36 PM


All replies