Tom's Guide > Forum > Programmation > * titre à éditer *

* titre à éditer *

Forum Programmation : * titre à éditer *

TomsGuide.com : 800 000 inscrits répondent à toutes vos questions high-tech et informatique. Pour obtenir de l'aide, inscrivez-vous gratuitement !
Mot :    Pseudo :           
 

Bonjour,

 

Pourriez vous me dire comment faire pour que mes clients l'écrivent de mon site à mona dresse e mail ? j'ai acheter un site sur gallica web et j'ai un document PHP et un document active server.

 

VOICI LE PHP:

 
Code :
  1. <?php
  2. //-----------------Getting data sent by flash---------------------
  3. foreach ($_POST as $key => $value){
  4. if ($key != 'mail_to' && $key != 'smtp_server' && $key != 'smtp_port' && $key != 'mail_from' && $key != 'mail_subject' && $key != 'plain_text'){
  5. $mail_body .= '<b>'.str_replace('_',' ',$key).'</b>:<br/>';
  6. $mail_body .= ''.stripslashes($value).'<br/>';
  7. }
  8. }
  9. //-----------------------------------------------------------------
  10. $message = '<html><body>'.$mail_body.'</body></html>'; // mail body
  11. //------------if plain text is set to true removing html tags------
  12. if ($_POST['plain_text']=='true') {
  13. $message = str_replace('<br/>',"\r\n", $message);
  14. $message = strip_tags($message);
  15. //------------------------------------------------------------------
  16. } else {
  17. //----otherwise composing message headers---------------------------
  18. $headers = 'MIME-Version: 1.0' . "\r\n";
  19. $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  20. //------------------------------------------------------------------
  21. }
  22. //------------setting conf data-------------------------------------
  23. $to = $_POST['mail_to'];
  24. $from = $_POST['mail_from'];
  25. $subject = $_POST['mail_subject'];
  26. $smtp_server = $_POST['smtp_server'];
  27. $smtp_port = $_POST['smtp_port'];
  28. //------------------------------------------------------------------
  29. //---------setting header info--------------------------------------
  30. $headers .= 'To: '.$to. "\r\n";
  31. $headers .= 'From: Site visitor ' .$from. "\r\n";
  32. //------------------------------------------------------------------
  33. if (mail($to, $subject, $message, $headers)){ // sending mail
  34. print('&mail=1'); //succes
  35. } else {
  36. print('&mail=0');//failure
  37. }
  38. ?>
 

ET VOICI LE DOCUMENT ACTIVE SERVER:

 
Code :
  1. Dim RegEx
  2. set RegEx = New RegExp
  3. '--------------------------------------------
  4. '------getting data sent by flash (filtering configuration data)------------
  5. For Each fld in Request.Form
  6. If Request.Form(fld) <> "" and _
  7. fld <> "mail_to" and _
  8. fld <> "smtp_server" and _
  9. fld <> "smtp_port" and _
  10. fld <> "plain_text" and _
  11. fld <> "mail_from" and _
  12. fld <> "mail_subject" Then
  13. myBody = myBody & vbCRLF & " <b>" & fld & "</b> :<br/> " & Trim(Request.Form(fld)) & "<br/>"
  14. End If
  15. Next
  16. '---------------------------------------------------------------------------
  17. '----------setting conf data------------------------------------------------
  18. On Error Resume Next
  19. Set myMail = CreateObject("CDO.Message" )
  20. myMail.Subject = Request.Form("mail_subject" )
  21. myMail.From =Request.Form("mail_from" )
  22. myMail.To = Request.Form("mail_to" )
  23. '--------if plain text is set to true removing html---------------------------------------
  24. if Request.Form("plain_text" ) = "true" then
  25. myMail.TextBody = RemoveHTML(myBody)
  26. '-------otherwise composing message body--------------------------------------------------
  27. else myMail.HTMLBody = "<html><body>" & myBody & "</body></html>"
  28. end if
  29. '----------setting configuration params for smtp----------------------------------------------------------------------------------
  30. myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing" ) = 1
  31. myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver" ) = Request.Form("smtp_server" )
  32. myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport" ) = Request.Form("smtp_port" )
  33. myMail.Configuration.Fields.Update
  34. '---------------------------------------------------------------------------------------------------------------------------------
  35. myMail.Send '---------------sending message
  36. If Err = 0 Then
  37. Response.Write("&mail=1" ) 'if there the message is sent return 1 to flash
  38. Else
  39. Response.Write("&mail=0" ) 'otherwise return 0
  40. End If
  41. %>
 

XML configuration:

Code :
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!--
  3. -- Please read this information to learn how to set up the contact form integrated
  4. -- into the template.
  5. --
  6. -- This readme file explains in details the meaning of the settings that can be
  7. -- done in the fcContactFormConfiguration.xml configuration file.
  8. --
  9. -- It is recommended for you to use an XML editor to make changes to this file
  10. -- because it’s less possible to make an error in the markup which can cause to
  11. -- a not working contact form.
  12. -->
  13. <contactFormConfiguration>
  14. <!--
  15. -- An e-mail address which will be used to receive messages from your contact form.
  16. -- You can specify several e-mail addresses separating them with a comma.
  17. -- For example: first_email@domain.com, second_email@domain.com, third@domain.com
  18. -->
  19. <emailTo>matt.morgan@orange.fr</emailTo>
  20. <!--
  21. -- A server script type which will process sending e-mails. It depends on your
  22. -- hosting and in the current version of the contact form it is allowed to use
  23. -- two types: php (Apache, PHP Hosting); asp (IIS web server, ASP).
  24. -->
  25. <serverProcessorType>php</serverProcessorType>
  26. <!--
  27. -- A name of the script file which process sending e-mails on your server (without
  28. -- extension). The name contact is used by default.
  29. -->
  30. <serverProcessorFileName>contact</serverProcessorFileName>
  31. <!--
  32. -- Set whether to validate only required fields (true/false). The default value is
  33. -- true which means the not required fields of your contact form will not be validated.
  34. -- For example if the e-mail field of your form is set as not required (imagine it)
  35. -- the form will be processed even if the user types in an incorrect e-mail address.
  36. -->
  37. <validateRequiredOnly>false</validateRequiredOnly>
  38. <!--
  39. -- Set whether to submit the form when the Enter key is pressed even if the focus is
  40. -- not on the Submit button (true/false).
  41. -->
  42. <submitFormOnEnter>false</submitFormOnEnter>
  43. <!--
  44. -- Text showing to the user when the form is submitted without any errors.
  45. -->
  46. <messageSentText>Thank you for your message.</messageSentText>
  47. <!--
  48. -- Text showing in case the form is not submitted because of a server error.
  49. -->
  50. <messageSentFailedText>Sorry, your message couldn't be sent</messageSentFailedText>
  51. <!--
  52. -- Text your visitor will see while waiting till the processing is over.
  53. -->
  54. <formProcessingText>processing...</formProcessingText>
  55. <!--
  56. -- Your SMTP server (for ASP only).
  57. -->
  58. <smtpServer>localhost</smtpServer>
  59. <!--
  60. -- Your SMTP port (for ASP only).
  61. -->
  62. <smtpPort>25</smtpPort>
  63. <!--
  64. -- Set whether to send the message as a plain text (true) or as HTML (false).
  65. -->
  66. <plainText>false</plainText>
  67. <!--
  68. -- ID of the input field (in the structure XML file) to use for the “from: ”
  69. -- or email to use instead (for example: mailfrom@domainname.com).
  70. -->
  71. <emailFromSource>3</emailFromSource>
  72. <!--
  73. -- Subject of the e-mails that will be sent through this contact form or ID of
  74. -- the input field (in the structure XML file) to use for the “subject: ” label
  75. -- in your e-mail client.
  76. -->
  77. <subjectSource>Contact Form from your site</subjectSource>
  78. <!--
  79. -- Validation error messages that are showing to the user when the form fails to
  80. -- validate. The form supports different types of validators. You can change the
  81. -- text of the error messages the validators produce here.
  82. --
  83. -- You can use the {LABEL} keyword in these messages. It will replace it with the
  84. -- label value of the field where an error occurs.
  85. -->
  86. <validationErrorMessages>
  87. <!--
  88. -- A required field is not filled in.
  89. -->
  90. <message type="fieldIsRequired">{LABEL} is required.</message>
  91. <!--
  92. -- The specified e-mail address is incorrect.
  93. -->
  94. <message type="emailNotValid">{LABEL} - is not valid email address.</message>
  95. <!--
  96. -- The specified number of characters in a field is less than a required minimum.
  97. -->
  98. <message type="minCharsLimitError">{LABEL} - The specified number of characters in a field is less than a required minimum.</message>
  99. <!--
  100. -- The specified string does not match with the regular expression.
  101. -->
  102. <message type="reqExpError">{LABEL} - The specified string does not match with the regular expression.</message>
  103. <!--
  104. -- The specified number is greater than an acceptable biggest number for this field.
  105. -->
  106. <message type="biggerThanMaxError">{LABEL} - The specified number is greater than an acceptable biggest number for this field.</message>
  107. <!--
  108. -- The specified number is lower than an acceptable lowest number for this field.
  109. -->
  110. <message type="lowerThanMinError">{LABEL} - The specified number is lower than an acceptable lowest number for this field.</message>
  111. <!--
  112. -- The data is not a number.
  113. -->
  114. <message type="notANumberError">{LABEL} - The data is not a number.</message>
  115. <!--
  116. -- The specified number must not be negative.
  117. -->
  118. <message type="negativeError">{LABEL} - The specified number must not be negative.</message>
  119. <!--
  120. -- The minimum number of variants is not selected
  121. -->
  122. <message type="minRequirementError">{LABEL} - The minimum number of variants is not selected</message>
  123. <!--
  124. -- The number of variants selected exceeds the maximum
  125. -->
  126. <message type="maxRequirementError">{LABEL} - The number of variants selected exceeds the maximum</message>
  127. <!--
  128. -- The fields that should be equal do not match
  129. -->
  130. <message type="shouldBeEqualError">{LABEL} - values do not match</message>
  131. <!--
  132. -- The date has wrong format.
  133. -->
  134. <message type="dateIsNotValidError">{LABEL} - date has wrong format</message>
  135. </validationErrorMessages>
  136. </contactFormConfiguration>
 

ET XML STRUCTURE:

 
Code :
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <contactFormStructure>
  3. <formItems>
  4. <item id="1" label="Name" required="true">
  5. <textToShow>Name*:</textToShow>
  6. </item>
  7. <item id="2" label="Phone">
  8. <textToShow>Phone:</textToShow>
  9. <restrict>+-.0-9</restrict>
  10. </item>
  11. <item id="3" label="E-mail" required="true">
  12. <textToShow>E-mail*:</textToShow>
  13. <validator>EmailValidator</validator>
  14. </item>
  15. <item id="4" label="Message" required="true">
  16. <textToShow>Message*:</textToShow>
  17. </item>
  18. </formItems>
  19. </contactFormStructure>
 


COMMENT FAIRE POUR SE SERVIR DE TOUS CELA ALORS SVP ?
MERCI D4AVANCE


Message édité par SiM07 le 20-07-2009 à 12:17:32
Liens sponsorisés
Inscrivez-vous ou connectez-vous pour masquer ceci.

Le titre de ce sujet a été édité par SiM07

------------------------------ 20minutes.fr, l'information en continu.
Répondre à SiM07

heuu tu veux quoi exatement ?

uen page avec un formulaire pour les visiteur puisse t'ecrire ?

------------------------------ XD --> peut aussi se dessiner --> XP
Microsoft se fout-il pas ne notre tete avec son XP ???
Répondre à andrelec1
Tom's Guide > Forum > Programmation > * titre à éditer *
Aller à :

Il y a 358 utilisateurs connus et inconnus. Pour voir la liste des connectés connus, cliquez ici.

Liens