none
Send an message with an HTML form...

    Question

  • 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
      .Update
     End With
     With sdoMsg
      Set .Configuration = sdoConfig
      ''''''''' receptor dos recibos
      .Fields(cdoDispositionNotificationTo) = "SENDER@mail.pt"
      .Fields(cdoReturnReceiptTo) = "SENDER@mail.pt"
      .Fields(cdoReturnPath) = "SENDER@mail.pt"   
      .DSNOptions = cdoDSNDefault
      '''''''''''''''''''''''''''''''''''''''''''''''''''
      .MDNRequested = True
      .From = "SENDER@mail.pt"
      ''''''''''''''''''''''''''''''''''''''''''''''''''
      .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
      Else
       .TextBody = KORPO
      End If
      .Fields.Update
      .Send
     End With
     Set sdoMsg = Nothing
     Set sdoConfig = Nothing
     Set sdoFields = Nothing
     qINCIDENT = "OK"
     Exit Function
    ERROT:
     MsgBox "Error IN SENDING : " + vbLf + CStr(Err.Number) + Err.Description, vbCritical
    End Function
    


    The HTML:

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

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

    TIA

    João

     

     

     

     

     

     

    Tuesday, November 01, 2011 6:36 PM

Answers

All replies