-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
111 lines (102 loc) · 3.59 KB
/
index.php
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
<!DOCTYPE html>
<!--
* Direitos Autorais (C) 2014 Wagner Hahn Silveira.
*
* Autor:
* Wagner Hahn Silveira <[email protected]>
*
* Este software é licenciado sob os termos da Licença Pública Geral GNU
* License versão 2, como publicada pela Fundação de Software Livre, e
* pode ser copiada, distribuida, e modificada sob estes termos.
*
* Este programa é distribuido na esperança que será util,
* mas SEM NENHUMA GARANTIA; sem mesmo a garantia implícita de
* COMERCIALIZAÇÃO ou de ADEQUAÇÃO A UM DETERMINADO FIM. veja o
* Licença Pública Geral GNU para obter mais detalhes.
*
*/
-->
<html>
<head>
<meta charset='UTF-8'>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
<style>
</style>
</head>
<body>
<form action="" method='POST' enctype="multipart/form-data" >
<div style='margin:auto;width:655px'>
<h3 style='text-align:center;'>SMTP autenticado</h3>
<br/>
<table class='table-responsive'>
<!-- -->
<tbody>
<tr>
<td><label>Servidor SMTP:</label></td>
<td><input class='form-control' style='width:400px' type='text' name='servidor' placeholder="smtp.exemplo.com.br"/><br/></td>
</tr>
<!-- -->
<tr>
<td><label>Porta SMTP:</label></td>
<td><input class='form-control' style='width:60px' type='text' name='porta' placeholder="587"/><br/></td>
</tr>
<!-- -->
<tr>
<td><label>Remetente:</label></td>
<td><input class='form-control' type='text' name='rementente' placeholder="[email protected]"/> <br/></td>
</tr>
<!-- -->
<tr>
<td><label>Senha Remetente:</label></td>
<td><input class='form-control' type='password' name='senha' placeholder="Senha de acesso"/> <br/></td>
</tr>
<!-- -->
<tr>
<td><label>Identidade:</label></td>
<td><input class='form-control' type='text' name='identidade' placeholder="Fulano | Empresa S.A"/> <br/></td>
</tr>
<!-- -->
<tr>
<td><label>Destinatário:</label></td>
<td><input class='form-control' type='text' name='destinatario' placeholder="[email protected]"/> <br/></td>
</tr>
<!-- -->
<tr>
<td><label>Assunto:</label></td>
<td><input class='form-control' type='text' name='assunto' placeholder="Assunto da Mensagem"/> <br/></td>
</tr>
<tr>
<tr>
<td><label>Mensagem:</label> </td>
<td><textarea class='form-control' name='mensagem' style='width:100%' placeholder="Insira sua Mensagem aqui"></textarea> <br/></td>
</tr>
<tr>
<td colspan='3'><input type='submit' name='btenvia' class='btn btn-primary btn-block' style='width:100%;height:50px' value='Enviar'/></td>
</tr>
</tbody>
</table>
</div>
</form>
</body>
</html>
<?php
if(isset($_POST['btenvia'])){
include 'Smtp.class.php';
### Dados para o envio #####
$servidor =$_POST['servidor'];
$rementente= $_POST['rementente'];
$identidade= $_POST['identidade'];
$senha=$_POST['senha'];
$destinatario=$_POST['destinatario'];
$assunto=$_POST['assunto'];
$mensagem=$_POST['mensagem'];
$porta=$_POST['porta'];
### Envia a mensagem ###
if(fsockopen($servidor,$porta)){
$smtp = new Smtp($servidor,$rementente,$senha,$porta ,true);
$smtp->enviar($destinatario ,$rementente, $assunto, $mensagem,$identidade);
}else{
echo "Não foi possivel conectar no servidor SMTP: $servidor e na porta $porta";
}
}
?>