Se connecter avec
S'enregistrer | Connectez-vous

You are not allowed to do this.

* titre à éditer *

Dernière réponse : dans Programmation

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:

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


ET VOICI LE DOCUMENT ACTIVE SERVER:

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


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


ET XML STRUCTURE:

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



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

Autres pages sur : titre editer

Lassé par la pub ? Créez un compte
Lassé par la pub ? Créez un compte
Tom's guide dans le monde