01.
<?php
02.
03.
04.
05.
06.
07.
08.
$path_to
=
'../'
;
09.
10.
11.
require
'../config.inc.php'
;
12.
require
'../lib.inc.php'
;
13.
require
'../init.inc.php'
;
14.
15.
16.
$db
=
new
MysqlDB(DB_HOSTNAME, DB_DATABASE, DB_USERNAME, DB_PASSWORD);
17.
18.
@mysql_connect(DB_HOSTNAME,DB_USERNAME,DB_PASSWORD)
or
die
(mysql_error());
19.
@mysql_select_db(DB_DATABASE)
or
die
(mysql_error());
20.
21.
22.
23.
24.
25.
26.
$body_id
=
'Application_Send'
;
27.
28.
include
$path_to
.
'top.incs.php'
;
29.
30.
$sql_send
=
"SELECT ty_listdetail. * ,ty_application. * FROM ty_listdetail , ty_application WHERE ty_listdetail.id_job = ty_application.id_job && id=$_GET[send]"
;
31.
$query
=mysql_query(
$sql_send
)
or
die
(mysql_error());
32.
echo
$sql_send
;
33.
while
(
$rec
=mysql_fetch_assoc(
$query
)){
34.
35.
$strTo
=
"nardanong.s@toscanavalley.com"
;
36.
$strSubject
=
"New Application"
;
37.
$strMessage
=
"Name : $rec[name]"
.
"<br/>"
.
" Surname : $rec[surname]"
.
"<br/>"
.
" Apply for position : $rec[position]"
.
"<br/>"
.
" telephone : $rec[telephone]"
.
"<br/>"
.
" Mobile :[mobile]"
.
"<br/>"
.
"Experted Salary $rec[experted_salary]"
;
38.
39.
40.
$strSid
= md5(uniqid(time()));
41.
42.
$strHeader
=
""
;
43.
$strHeader
.=
"From: Name : $rec[name]"
.
" Surname : $rec[surname]"
.
"<$rec[email]>"
.
"\nReply-To: nardanong.s@toscanavalley.com\n"
;
44.
45.
46.
47.
$strHeader
.=
"MIME-Version: 1.0\n"
;
48.
$strHeader
.=
"Content-Type: multipart/mixed; boundary=\""
.
$strSid
.
"\"\n\n"
;
49.
$strHeader
.=
"This is a multi-part message in MIME format.\n"
;
50.
51.
$strHeader
.=
"--"
.
$strSid
.
"\n"
;
52.
$strHeader
.=
"Content-type: text/html; charset=windows-874\n"
;
53.
$strHeader
.=
"Content-Transfer-Encoding: 7bit\n\n"
;
54.
$strHeader
.=
$strMessage
.
"\n\n"
;
55.
56.
57.
$strFilesName1
=
"application/$rec[resume_file]"
;
58.
$strContent1
=
chunk_split
(
base64_encode
(
file_get_contents
(
$strFilesName1
)));
59.
$strHeader
.=
"--"
.
$strSid
.
"\n"
;
60.
$strHeader
.=
"Content-Type: application/octet-stream; name=\""
.
$strFilesName1
.
"\"\n"
;
61.
$strHeader
.=
"Content-Transfer-Encoding: base64\n"
;
62.
$strHeader
.=
"Content-Disposition: attachment; filename=\""
.
$strFilesName1
.
"\"\n\n"
;
63.
$strHeader
.=
$strContent1
.
"\n\n"
;
64.
65.
$flgSend
= @mail(
$strTo
,
$strSubject
,null,
$strHeader
);
66.
if
(
$flgSend
)
67.
{
68.
echo
"<script>alert('Email send successfully')</script>"
;
69.
}
70.
else
71.
{
72.
echo
"<script>alert('Email can't successfully')</script>"
;
73.
}
74.
}
75.
?>
76.
</body>
77.
</html>