php带抄送和密件抄送的邮件发送方法_PHP教程

WBOY
Freigeben: 2016-07-13 10:01:26
Original
1010 Leute haben es durchsucht

php带抄送和密件抄送的邮件发送方法

 这篇文章主要介绍了php带抄送和密件抄送的邮件发送方法,涉及php中mail函数的使用技巧,非常具有实用价值,需要的朋友可以参考下

 

 

本文实例讲述了php带抄送和密件抄送的邮件发送方法。分享给大家供大家参考。具体分析如下:

程序中用到了php的mail函数,该函数定义如下:
bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
如果邮件发送成功返回True,否则返回False

?

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

Send email with CC and BCC

To

Name
E-mail

CC

BCC

Priority

Subject

Message

后端php代码,保存为sendmail.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

Send Mail Script

$message= " " ;

if (empty ( $mailtoname) || empty ( $mailtomail) ) {

die ( "Recipient is blank! ") ;

}else{

$to = $mailtoname . " " ;

}

if ( empty ( $mailsubject) ) {

$mailsubject=" ";

}

if (($mailpriority>0) && ($mailpriority

$mailheader = "X-Priority: ". $mailpriority ."\n";

}

$mailheader.= "From: " . "Sales Team \n";

$mailheader.= "X-Sender: " . "support@yourdomain.com\n";

$mailheader.= "Return-Path: " . "support@yourdomain.com\n";

if (!empty($mailcc)) {

$mailheader.= "Cc: " . $mailcc ."\n";

}

if (!empty($mailbcc)) {

$mailheader.= "Bcc: " . $mailbcc ."\n";

}

if (empty($mailbody)) {

$mailbody=" ";

}

$result = mail ($to, $mailsubject, $mailbody, $mailheader);

echo "

Mail sent to ". "$to". "
";

echo $mailsubject. "
";

echo $mailbody. "
";

echo $mailheader. "
";

if ($result) {

echo "

Email sent successfully!

";

}else{

echo "

Email could not be sent.

";

}

?>

To

CC
BCC
Priority
Subject
Message

希望本文所述对大家的php程序设计有所帮助。

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/971946.htmlTechArticlephp带抄送和密件抄送的邮件发送方法 这篇文章主要介绍了php带抄送和密件抄送的邮件发送方法,涉及php中mail函数的使用技巧,非常具有实用价...
Verwandte Etiketten:
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!