phpmailer in een werkend contactformulier met upload
Ik ben op zoek naar iemand die phpmailer in mijn contactformulier kan zetten.
Het formulier funtioneerd al volledig, alleen ondersteund mijn hosting geen gewone mailfunctie!
* Werkzaamheden: PHPmailer integreren in bestaand script
* Graag voor een vaste redelijke prijs (ca 30 euro)
Bij interesse graag mailen naar [email protected]
Niels
Kun je via php een verbinding met poort 25 opbouwen?
Met andere woorden:
Code (php)
Gewijzigd op 09/04/2011 21:44:35 door Marco Hauer
dat ging inderdaad wel gewoon. Poort 25 is open.......
Poort 25 is open? Welke provider is dat? :-D Je kunt dan gewoon mailen, zonder enige beperking! Een paradijs voor spammers :-D
Probeer het dan eens met deze functie:
Code (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
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
<?php
function another_mail($to,$subject,$message,$headers,$from){
list($me,$mydomain) = split("@",$from);
// Now look up the mail exchangers for the recipient
list($user,$domain) = split("@",$to);
if(!getmxrr($domain,$mx,$weight)) return FALSE;
// Try them in order of lowest weight first
array_multisort($mx,$weight);
$success=0;
foreach($mx as $host) {
// Open an SMTP connection
if (!$connection = @fsockopen ($host, 25, $errno, $errstr, 20)){
echo "<br>Could not connect to $host smtp port 25 : $errno : $errstr", "<br>";
$host = gethostbyname($host);
if (!$connection = @fsockopen ($host, 25, $errno, $errstr, 20)){
echo "Could not connect to $host smtp port 25 : $errno : $errstr", "<br>";
continue;
}
}
$res=@fgets($connection,256);
if(substr($res,0,3) != "220") break;
// Introduce ourselves
fputs($connection, "HELO $_SERVER[SERVER_NAME]\r\n");
$res=fgets($connection,256);
if(substr($res,0,3) != "250") break;
// Envelope from
fputs($connection, "MAIL FROM:<$from>\r\n");
$res=fgets($connection,256);
if(substr($res,0,3) != "250") break;
// Envelope to
fputs($connection, "RCPT TO:<$to>\r\n");
$res=fgets($connection,256);
if(substr($res,0,3) != "250") break;
// The message
fputs($connection, "DATA\r\n");
$res=fgets($connection,256);
if(substr($res,0,3) != "354") break;
// Send To:, From:, Subject:, other headers, blank line, message, and finish
// with a period on its own line.
fputs($connection, "To: $to\r\nSubject: $subject\r\n$headers\r\n\r\n$message\r\n.\r\n");
$res=fgets($connection,256);
if(substr($res,0,3) != "250") break;
// Say bye bye
fputs($connection,"QUIT\r\n");
$res=fgets($connection,256);
if(substr($res,0,3) != "221") break;
// It worked! So break out of the loop which tries all the mail exchangers.
$success=1;
break;
}
// Debug for if we fall over - uncomment as desired
print $success?"Mail sent :":"Failure: $res<br>";
if($connection) {
if($success==0) fputs($connection, "QUIT\r\n");
fclose ($connection);
}
return $success?TRUE:FALSE;
}
?>
function another_mail($to,$subject,$message,$headers,$from){
list($me,$mydomain) = split("@",$from);
// Now look up the mail exchangers for the recipient
list($user,$domain) = split("@",$to);
if(!getmxrr($domain,$mx,$weight)) return FALSE;
// Try them in order of lowest weight first
array_multisort($mx,$weight);
$success=0;
foreach($mx as $host) {
// Open an SMTP connection
if (!$connection = @fsockopen ($host, 25, $errno, $errstr, 20)){
echo "<br>Could not connect to $host smtp port 25 : $errno : $errstr", "<br>";
$host = gethostbyname($host);
if (!$connection = @fsockopen ($host, 25, $errno, $errstr, 20)){
echo "Could not connect to $host smtp port 25 : $errno : $errstr", "<br>";
continue;
}
}
$res=@fgets($connection,256);
if(substr($res,0,3) != "220") break;
// Introduce ourselves
fputs($connection, "HELO $_SERVER[SERVER_NAME]\r\n");
$res=fgets($connection,256);
if(substr($res,0,3) != "250") break;
// Envelope from
fputs($connection, "MAIL FROM:<$from>\r\n");
$res=fgets($connection,256);
if(substr($res,0,3) != "250") break;
// Envelope to
fputs($connection, "RCPT TO:<$to>\r\n");
$res=fgets($connection,256);
if(substr($res,0,3) != "250") break;
// The message
fputs($connection, "DATA\r\n");
$res=fgets($connection,256);
if(substr($res,0,3) != "354") break;
// Send To:, From:, Subject:, other headers, blank line, message, and finish
// with a period on its own line.
fputs($connection, "To: $to\r\nSubject: $subject\r\n$headers\r\n\r\n$message\r\n.\r\n");
$res=fgets($connection,256);
if(substr($res,0,3) != "250") break;
// Say bye bye
fputs($connection,"QUIT\r\n");
$res=fgets($connection,256);
if(substr($res,0,3) != "221") break;
// It worked! So break out of the loop which tries all the mail exchangers.
$success=1;
break;
}
// Debug for if we fall over - uncomment as desired
print $success?"Mail sent :":"Failure: $res<br>";
if($connection) {
if($success==0) fputs($connection, "QUIT\r\n");
fclose ($connection);
}
return $success?TRUE:FALSE;
}
?>
Je kunt ook PHPMailer gebruiken van: http://sourceforge.net/projects/phpmailer/
Deze bevat ook een 'SMTP Class', waarmee je e-mails direkt over poort 25 kunt afleveren.
Succes, voor zover dit onderwerp nog relevant is ;-)