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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
<?php
class IscrizioniController extends BaseController {
public function std()
{
return View::make('iscrizioni.std2015');
}
public function mail()
{
$nome = Input::get('nome');
$cognome = Input::get('cognome');
$azienda = Input::get('azienda');
$mail = Input::get('mail');
$telefono = Input::get('telefono');
$messages = array(
'required' => 'Il campo :attribute non può essere vuoto.',
'min' =>'Il campo :attribute è di minimo 3 caratteri.',
'same' => 'The :attribute and :other must match.',
'size' => 'The :attribute must be exactly :size.',
'between' => 'The :attribute must be between :min - :max.',
'in' => 'The :attribute must be one of the following types: :values',
'email' => 'Il campo :attribute non è corretto',
'numeric' => 'Il campo :attribute accetta solo numeri',
'alpha' => 'Il campo :attribute accetta solo caratteri alfabetici'
);
$userData = array(
'nome' => $nome,
'cognome' => $cognome,
'azienda' => $azienda,
'mail' => $mail,
'telefono' => $telefono
);
$rules = array(
'nome' => 'required|min:3|max:80|alpha',
'cognome' => 'required|min:3|max:80|alpha',
'azienda' => 'required|min:3|max:80',
'mail' => 'required|email',
'telefono' => 'required|numeric|min:8'
);
$validator = Validator::make($userData,$rules,$messages);
if($validator->fails())
{
return Redirect::to('iscrizioni/convegno')
->withErrors($validator)
->withInput();
}
else
{
//Send email using Laravel send function
/*Mail::send('emails.iscrizione', $userData, function($message) use ($userData)
{
//email 'From' field: Get users email add and name
//$message->from($userData['mail'] , $userData['nome']);
//email 'To' field: cahnge this to emails that you want to be notified.
//$message->to('eventi@aiba.it', 'AIBA')->cc('info@utgnet.com')->subject('Convegno Aiba 2016: Scheda di Adesione del Sig. '.$nome.' '.$cognome);
$message->to('bertiniemanuele@tiscali.it', 'Zycon')->subject('Convegno Aiba 2017: Scheda di Adesione del Sig. '.$userData['nome'].' '.$userData['cognome']);
});*/
//Email information
/*$admin_email = "eventi@aiba.it";
$email = "kranyo@hotmail.it";
$subject = "così funziona?";
$comment = "così funziona?";
//send email
mail($admin_email, $subject, $comment, "From:" . $email);*/
// multiple recipients
$to = 'eventi@aiba.it' . ', '; // note the comma
//$to .= 'info@utgnet.com';
// subject
$subject = 'Convegno Aiba 2020: Scheda di Adesione del Sig. '.$userData['nome'].' '.$userData['cognome'];
// message
$message = '
<h1>Convegno Aiba 2020: Scheda di Adesione del Sig. '.$userData['nome'].' '.$userData['cognome'].'</h1>
<p>
Nome: '. $userData['nome'] .' <br>
Cognome: '. $userData['cognome'] .' <br>
Azienda: '. $userData['azienda'] .'<br>
Email: '. $userData['mail'] .' <br>
Telefono: '. $userData['telefono'] .' <br>
Date: '. Carbon::now()->format('d/m/Y') .' <br>
User IP address: '.Request::getClientIp().'<br>
</p>
';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: Adesioni <adesioni@aiba.it>\r\n";
// Mail it
mail($to, $subject, $message, $headers);
return View::make('iscrizioni.success');
}
}
}
|