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
|
<?php // Setting a timezone, mail() uses this. date_default_timezone_set('America/New_York');
// recipients $to = "¹Þ´Â»ç¶÷À̸ÞÀÏÁÖ¼Ò" . ", " ; // note the comma
// subject $subject = "Test for Embedded Image & Attachement";
// Create a boundary string. It needs to be unique $sep = sha1(date('r', time()));
// Add in our content boundary, and mime type specification: $headers .= "\r\nContent-Type: multipart/mixed; boundary=\"PHP-mixed-{$sep}\"";
// Read in our file attachment $attachment = file_get_contents('÷ºÎÆÄÀϸí'); $encoded = base64_encode($attachment); $attached = chunk_split($encoded);
// additional headers $headers .= "To: You, $headers .= "From: Me \r\n";
$inline = chunk_split(base64_encode( file_get_contents('ÀÓº£µåµÉÀ̹ÌÁö¸í')));
// Your message here: $body =<<<EOBODY --PHP-mixed-{$sep} Content-Type: multipart/alternative; boundary="PHP-alt-{$sep}"
--PHP-alt-{$sep} Content-Type: text/plain
Hi!
--PHP-alt-{$sep} Content-Type: multipart/related; boundary="PHP-related-{$sep}"
--PHP-alt-{$sep} Content-Type: text/html
<html> <head> <title>Test HTML Mail</title> </head> <body> <font color='red'>Hai, it is me!</font> Here is my picture: <img src="cid:PHP-CID-{$sep}" /> </body> </html> --PHP-related-{$sep} Content-Type: image/gif Content-Transfer-Encoding: base64 Content-ID: <PHP-CID-{$sep}> {$inline} --PHP-related-{$sep}-- --PHP-alt-{$sep}--
--PHP-mixed-{$sep} Content-Type: application/zip; name="÷ºÎÆÄÀϸí" Content-Transfer-Encoding: base64 Content-Disposition: attachment
{$attached}
--PHP-mixed-{$sep}-- EOBODY; // Finally, send the email mail($to, $subject, $body, $headers); ?>
|