Problemas con envío de mail por php
Publicado por Anxela (1 intervención) el 05/01/2020 14:19:06
Tengo un formulario en una web pero no consigo que me envíe lo que escribo en el formulario al mail. El código del formulario es el siguiente:
Y el código del archivo .php es el siguiente:
Muchas gracias!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<section class="contact-section section_padding">
<div class="container">
<div class="d-none d-sm-block mb-5 pb-4">
<div class="text-center" id="map" style="height: 480px;">
<iframe
src="https://www.google.com/maps/embed?pb=!1m14!1m8!1m3!1d11779.708058017864!2d-8.6394775!3d42.4292884!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0x2d44d121e11281ea!2sVINCI%20ESTHETIQUE%20AVANCEE!5e0!3m2!1ses!2ses!4v1578056186874!5m2!1ses!2ses"
width="1000" height="450" frameborder="0" style="border:0;" allowfullscreen=""></iframe>
</div>
<div class="contact-section2">
<div class="row">
<div class="col-12">
<h2 class="contact-title">Estamos en contacto</h2>
</div>
<div class="col-lg-8">
<form class="form-contact contact_form" action="contact_process.php" method="post" id="contactForm"
novalidate="novalidate">
<div class="row">
<div class="col-12">
<div class="form-group">
<textarea class="form-control w-100" name="message" id="message" cols="30" rows="9"
onfocus="this.placeholder = ''" onblur="this.placeholder = 'Enter Message'" placeholder = 'Enter Message'></textarea>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" name="name" id="name" type="text" onfocus="this.placeholder = ''"
onblur="this.placeholder = 'Enter your name'" placeholder = 'Enter your name'>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control" name="email" id="email" type="email" onfocus="this.placeholder = ''"
onblur="this.placeholder = 'Enter email address'" placeholder = 'Enter email address'>
</div>
</div>
<div class="col-12">
<div class="form-group">
<input class="form-control" name="subject" id="subject" type="text"
onfocus="this.placeholder = ''" onblur="this.placeholder = 'Enter Subject'" placeholder = 'Enter Subject'>
</div>
</div>
</div>
<div class="form-group mt-3">
<button type="submit" class="button button-contactForm btn_4 boxed-btn">Send Message</button>
</div>
</form>
</div>
<div class="col-lg-4">
<div class="media contact-info">
<span class="contact-info__icon"><i class="ti-home"></i></span>
<div class="media-body">
<h3>Rúa Cruz Gallastegui, 17</h3>
<p>36004 Pontevedra</p>
</div>
</div>
<div class="media contact-info">
<span class="contact-info__icon"><i class="ti-tablet"></i></span>
<div class="media-body">
<h3>+34 622 76 53 55<br>+34 986 04 24 77</h3>
<p>Lunes a Viernes: 10:00-14:00<br> 16:00-20:00<br>Sábados: 10:00-13:00</p>
</div>
</div>
<div class="media contact-info">
<span class="contact-info__icon"><i class="ti-email"></i></span>
<div class="media-body">
<h3>info@vinci-esthetique.es</h3>
<p>Contacta con nosotros!</p>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
Y el código del archivo .php es el siguiente:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
$to = "admin@vinci-esthetique.es";
$from = $_REQUEST['email'];
$name = $_REQUEST['name'];
$subject = $_REQUEST['subject'];
$number = $_REQUEST['number'];
$cmessage = $_REQUEST['message'];
$headers = "From: $from";
$headers = "From: " . $from . "\r\n";
$headers .= "Reply-To: ". $from . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$subject = "You have a message from your Bitmap Photography.";
$logo = 'img/logo.png';
$link = '#';
$body = "<!DOCTYPE html><html lang='en'><head><meta charset='UTF-8'><title>Express Mail</title></head><body>";
$body .= "<table style='width: 100%;'>";
$body .= "<thead style='text-align: center;'><tr><td style='border:none;' colspan='2'>";
$body .= "<a href='{$link}'><img src='{$logo}' alt=''></a><br><br>";
$body .= "</td></tr></thead><tbody><tr>";
$body .= "<td style='border:none;'><strong>Name:</strong> {$name}</td>";
$body .= "<td style='border:none;'><strong>Email:</strong> {$from}</td>";
$body .= "</tr>";
$body .= "<tr><td style='border:none;'><strong>Subject:</strong> {$csubject}</td></tr>";
$body .= "<tr><td></td></tr>";
$body .= "<tr><td colspan='2' style='border:none;'>{$cmessage}</td></tr>";
$body .= "</tbody></table>";
$body .= "</body></html>";
$send = mail($to, $subject, $body, $headers);
?>
Muchas gracias!
Valora esta pregunta


0