Advertisement

05.01.2008 at 10:53PM PDT, ID: 23370807 | Points: 500
[x]
Attachment Details

How to send HTML formatted mail using CGI script

Tags: CGI Script, Any Browser
Hello Experts,
I have already one mail system in which I want to make some modification.
System developed using CGI Script Language. In that system it sends plain text mail. But now I. want to send formatted mail (HTML mail) but when I send mail to particular use it shows the html tag in the mail.
  So please tell me how I can do that .
Tanks
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: dotsandcoms
Question Asked On: 05.01.2008
Participating Experts: 1
Points: 500
Views: 0
Translate:
Loading Advertisement...
05.02.2008 at 04:30AM PDT, ID: 21485782

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.02.2008 at 05:18AM PDT, ID: 21486021

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • Automotive
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Displays / Monitors
  • Handhelds / PDAs
  • Components
  • Peripherals
  • Laptops/Notebooks
  • Servers
  • Misc
  • Apple
  • Embedded Hardware
  • Networking Hardware
  • Storage
  • Desktops
  • New Users
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMware
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Virtualization
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • Web Computing
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Consulting
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMware
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Automation
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Web Services
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Web Computing
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Lounge
  • Business Travel
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
  • Automotive
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
05.02.2008 at 04:30AM PDT, ID: 21485782
How do you construct your email, is it using Perl script or other languange? In the email body, do you have a header to identify the conent type, something like:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Email Notification</title>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
</head>

<body>
 
05.02.2008 at 05:18AM PDT, ID: 21486021
expert i think u r very near to the solution. i send u my actual code it wrok properly but not show proper formatted text it show bold text like <strong>hi</strong>
my code is ......



<html>
<head>
<script src="advanceeditor/jscripts/tiny_mce/tiny_mce.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
      mode : "textareas",
      theme : "advanced",
      plugins : "table,contextmenu",
      theme_advanced_buttons3_add_before : "tablecontrols,separator",
      theme_advanced_buttons1_add : "fontselect,fontsizeselect",
      theme_advanced_buttons2_add : "insertdate,inserttime,preview,separator,forecolor,backcolor",
      theme_advanced_toolbar_location : "top",
      theme_advanced_toolbar_align : "left"
      
});
</script>
<script language="JavaScript"><!--
      var myDefaultLanguage="<!--IMAIL.Include.config_DefaultLanguage.cgi-->"
      var myCharset="<!--IMAIL.Include.config_DefaultLanguageCharset.cgi-->"
<!--IMAIL.Include.languageLoader.cgi-->

      //-->
</script>

  <!--File: SendMail.HTML-->
  <script language="JavaScript" type="text/javascript"><!--
  <!--IMAIL.Include.functions.cgi-->
      
      myRecipientFieldLengthLimit=parseInt('<!--IMAIL.Include.config_RecipientFieldLengthLimit.cgi-->');

  <!--IMAIL.Include.sm_js.cgi-->


      function resizeText(form)
      {
        var winSize;
        var boxLength;
        (is_ie4up)?winSize=document.body.clientWidth:(is_nav4up)?winSize=self.innerWidth:winSize=500;
        (winSize>799)?boxLength=72:boxLength=52;
        form.textBody.cols=boxLength;
      }
      
function myLoad(){
      if(location.pathname.indexOf("sendmail.")==-1 && location.pathname.indexOf("exitspell.")==-1 ){
            var sigValue = document.SendMail.signature.value;
            //keyr 1
            //alert(document.SendMail.signature.value);
             
            if(document.SendMail.textBody.value.length>1){
                  document.SendMail.textBody.value += sigValue;                  
                  }else{
                  document.SendMail.textBody.value = sigValue;
            }
      }
      if(spellCheckEnabled){
            renameDict();
      }
      document.SendMail.to.focus();
}

var myPage="compose"
w('<title>'+X.SendMsg+' - <!--IMAIL.CurrentDomain-->'+'</title>')

function selectAddress(oSelect, oEvent) {
      var sKeyCode = oEvent.keyCode;
      var sToChar = String.fromCharCode(sKeyCode);
      if(sKeyCode >47 && sKeyCode<91){
            var sNow = new Date().getTime();
            if (oSelect.getAttribute("finder") == null) {
                  oSelect.setAttribute("finder", sToChar.toUpperCase())
                  oSelect.setAttribute("timer", sNow)
            } else if( sNow > parseInt(oSelect.getAttribute("timer"))+2000) { //Rest all;
                  oSelect.setAttribute("finder", sToChar.toUpperCase())
                  oSelect.setAttribute("timer", sNow) //reset timer;
            } else {
                  oSelect.setAttribute("finder", oSelect.getAttribute("finder")+sToChar.toUpperCase())
                  oSelect.setAttribute("timer", sNow); //update timer;
            }
            var sFinder =  oSelect.getAttribute("finder");
            var arrOpt = oSelect.options
            var iLen = arrOpt.length
            for (var i = 0; i < iLen ; i++) {
                  sTest  = arrOpt[i].text.replace("\"","");
                  if (sTest.toUpperCase().indexOf(sFinder) == 0) {
                        arrOpt[i].selected = true;
                        break;
                  }
            }
            //oEvent.returnValue = false;
      } else{
            //Not a digit;
      }
}
//--></script>
</head>
  <!--IMAIL.Include.style.cgi-->
<body>
  <!--IMAIL.Include.newheader.cgi-->
<form name="SendMail" method="POST" action="sendmail.<!--IMAIL.Number-->.cgi"
    <!--IMAIL.BeginAttachmentSupport--> enctype="multipart/form-data">
    <input type="hidden" name="uid" value="<!--IMAIL.UserID-->">
    <!--IMAIL.ElseBeginAttachmentSupport-->
    <!--IMAIL.EndBeginAttachmentSupport-->
    <input type="hidden" name="page"      value="sendmail">
    <input type="hidden" name="mbx"       value="<!--IMAIL.CurrentMailbox-->">
    <input type="hidden" name="msg"       value="<!--IMAIL.CurrentUnsortedMessageNum-->">
    <INPUT TYPE="hidden" NAME="msgsort"   VALUE="<!--IMAIL.CurrentSortedMessageNum-->">
            <input type="hidden" name="button"    value="">
    <input type="hidden" name="index"     value="">
    <input type="hidden" name="FwdNoEdit" value="<!--IMAIL.ForwardNoEditStatus-->">
            <INPUT TYPE="hidden" NAME="MsgType" VALUE="<!--IMAIL.MsgType-->">
            <!--keyur -2-->
            <!--<input type="hidden" name="Content-type" value="text/html" />
            <input type="hidden" name="charset" value="iso-8859-1" />-->
    <input type="hidden" name="mbxdate"   value="<!--IMAIL.MboxModTimeStamp-->">
            <INPUT TYPE="hidden" Name="SpellCheckOn" VALUE="<!--IMAIL.SpellCheckerOn-->">
            <input type="hidden" name="messagetrailer"   value="<!--IMAIL.Include.config_MessageTrailer.cgi-->">
            <input name="signature" type=hidden value="<!--IMAIL.SignatureFileContents-->">
<table border=0 cellpadding="3" cellspacing="0" align="center" width=96%>
<tr><td>
<table border=0 cellpadding="3" cellspacing="0" align="center" width="100%">
      <tr>
        <td align="right" valign="bottom"><nobr>
          <b><script>w(X.From)</script></b>:
        </td>
        <td valign="bottom">
          <b><!--IMAIL.ReplyToWhom--></b>
        </td>
      </tr>
      <tr>
        <td align="right"><nobr>
          <b><script>w(X.To)</script></b>:
        </td>
        <td>
          <input type="text" style="width:100%;" maxlength="<!--IMAIL.Include.config_RecipientFieldLengthLimit.cgi-->" name="to"
            value="<!--IMAIL.SendTo-->" onkeydown="selectAddress(document.forms.SendMail.lstAddr,event);">
        </td>
      </tr>
      <tr>
        <td align="right"><nobr>
          <b><script>w(X.CC)</script></b>:
        </td>
        <td>
          <input type="text"  style="width:100%;" maxlength="<!--IMAIL.Include.config_RecipientFieldLengthLimit.cgi-->" name="cc"
            value="<!--IMAIL.SendCC-->" onkeydown="selectAddress(document.forms.SendMail.lstAddr,event);">
        </td>
      </tr>
      <tr>
        <td align="right"><nobr>
          <b><script>w(X.BCC)</script></b>:
        </td>
        <td>
          <input type="text"  style="width:100%;" maxlength="<!--IMAIL.Include.config_RecipientFieldLengthLimit.cgi-->" name="bcc"
            value="<!--IMAIL.SendBCC-->" onkeydown="selectAddress(document.forms.SendMail.lstAddr,event);">
        </td>
      </tr>
      <tr>
        <td align="right"><nobr>
          <b><script>w(X.Subject)</script></b>:
        </td>
        <td>
          <input type="text"  style="width:100%;" maxlength="255" name="sbj"
            value="<!--IMAIL.SendSubject-->">
        </td>
      </tr>
      </table>
        </td>
       
        <td valign=top width=200>
        <a href="addrbook.<!--IMAIL.Number-->.cgi?uid=<!--IMAIL.UserID-->&mbx=<!--IMAIL.CurrentMailBox-->"><img src=images/saveaddr.gif border=0 align=absmiddle> <b><script>w(X.AddressBook)</script></b></a>
           <table border=0 cellpadding="0" cellspacing="5" width="200">
      <tr><td align="center">

  <select name="lstAddr" style="width:140px" multiple onDblClick="selectAddresses('To');">
      <!--IMAIL.GetContactList-->
  <!--IMAIL.GetAddresses-->
  <option value=""></option>

      <script language="JavaScript"><!--
            var address = document.SendMail.lstAddr.options[0].text
        if (address.indexOf("Addresses--") >= 0) {
              document.SendMail.lstAddr.options[0].text = X.NoAddrs
        }                        
            var myDivider = X.CmnAddrsDiv;
            document.write('<option value="">'+myDivider);
            var myAddresses = '<!--IMAIL.Include.config_CommonAddrBook.cgi-->';
            var myAddrArray = myAddresses.split(",");
            var x=""
            for (var i=0;i<myAddrArray.length;i++){
                  x+='<option value="1">'+myAddrArray[i]+'</option>'
                  }
            document.write(x)
            
      //-->
      </script>
  </select>
      </td>
      <td align="left" valign="top"><nobr>
 
       <script>w(X.SelAddrs)</script><br>
      <a href="javascript:selectAddresses('TO')"><b><script>w(X.SendTo)</script></b></a><br>
      <a href="javascript:selectAddresses('CC')"><b><script>w(X.CarbonCpy)</script></b></a><br>
      <a href="javascript:selectAddresses('BCC')"><b><script>w(X.BlindCC)</script></b></a><br></td>
  </tr>
      </table>  
        </td>
      </tr>
      </table>
  <table border=0 cellpadding="3" cellspacing="0" align="center" width="96%">    
      <tr>
        <td align="right">&nbsp;
        </td>
        <td align="left">
          <input type="checkbox" name="saveaddr" <!--IMAIL.SaveAddrState-->>
          <script>w(X.AddRcptsToAB)</script><input type="checkbox" name="savemsg" <!--IMAIL.SaveMsgState-->>
          <script>w(X.SaveInSent)</script>
        </td>
      </tr>

     <!---  </tr>
        <td align="right">&nbsp;
        </td>
        <td align="left">
          <input type="checkbox" name="sign" <!--IMAIL.SendSignature-->>
        </td>    
      </tr>--->
     
      <tr>
        <td colspan="2"><textarea name="textBody" style="width:100%;height:300px" cols="1" ><!--IMAIL.SendMsgBody--></textarea></td>
      </tr>
      <tr><td colspan="2" align="center" nowrap valign="top">
                  
      <!--- SpellChecker code --->
                  <!--IMAIL.BeginIfUserSpellCheckEnable-->
                  <table border=0 cellpadding=0 cellspacing=0 width=100%>
                  <tr>
                  <td width=240><SELECT class="composeMsg" NAME="lexicons" MULTIPLE SIZE="3" style="width:240px">
                  <!--IMAIL.GetDictionaries-->
                  </SELECT></td>
                  <td valign=bottom>&lt;&lt; <script>w(X.SelDicts)</script></td>
                  </tr>
                  </table>
<br>            
                  <a href="javascript:getStatusForSplChkr()"><b><img src=images/spell.gif border=0 align=absmiddle> <script>w(X.SpellChk)</script></b></a>
      &nbsp;&nbsp;|&nbsp;&nbsp;
                  <!--IMAIL.EndBeginIfUserSpellCheckEnable-->
          <a href="javascript:valsb()"><img src=images/sendmail.gif border=0 align=absmiddle> <b><script>w(X.SendMsg)</script></b></a>
      &nbsp;&nbsp;|&nbsp;&nbsp;
      <a href="javascript:valsbsave()"><img src=images/save.gif border=0 align=absmiddle> <script>w(X.SaveMsg)</script></a>
      </td>
  </tr>
</table>

      <p>
            <!--IMAIL.BeginAttachmentSupport-->
            <input type="hidden" name="status" value="<!--IMAIL.AttachStatus-->">
            <center><table border="0" width="96%" align=center>
              <tr>
                <td><b><script>w(X.Attachments)</script></b><br>
           
                                    <script>w(X.AttNoteCwm)</script><br><br>
            <input type="hidden" name="attfile" value="<!--IMAIL.AttachedFile-->">
            <table align="left">
              <tr>
                <td>
                      <select name="attachlist" multiple size="4"><!--IMAIL.AttachedList--></select>
                    </td>
                    <td valign="top">
                                                <script>w('<a href="javascript:addattach()"><b>&lt;&lt; '+X.Attach+' &lt;&lt;&nbsp;&nbsp;</b></a>')</script>
               
                <input type="file" size=18 name="userfile1" maxlength="256"><br>
                      <a href="javascript:removeattach()"><b><script>w(X.Remove)</script></b></a><br>
                    </td>
                  </tr>
                  <tr>
                    <td colspan=2 nowrap>
                      <script>w(X.Total)</script>: <b><!--IMAIL.AttachedCount--></b> <script>w(X.Files)</script>,
                      <b><!--IMAIL.AttachedSize--></b> <script>w(X.Kb)</script>
                    </td>
                  </tr>
                </table>

</td></tr>
</table></center>

          <!--IMAIL.ElseBeginAttachmentSupport-->
                <input type="hidden" name="status" value="<!--IMAIL.AttachStatus-->">
          <!--IMAIL.EndBeginAttachmentSupport-->
              <input type="hidden" name="eom" value="true">


      </form>
 
<script language="javascript">
myLoad();
</script>
</body>
</html>  


 
 
20080236-EE-VQP-29 / EE_QW_2_20070628