Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
da9a8987
Commit
da9a8987
authored
20 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Doc: Documentation doxygen
parent
9e918bb3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
htdocs/lib/CMailFile.class.php
+39
-49
39 additions, 49 deletions
htdocs/lib/CMailFile.class.php
with
39 additions
and
49 deletions
htdocs/lib/CMailFile.class.php
+
39
−
49
View file @
da9a8987
...
...
@@ -28,6 +28,9 @@ to chunk_split
/** \class CMailFile
\brief Classe d'envoi de mails et pices jointes. Encapsule mail() avec d'ventuel attachements.
\remarks Usage:
\remarks $mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filename,$mimetype);
\remarks $mailfile->sendfile();
*/
class
CMailFile
...
...
@@ -54,7 +57,7 @@ class CMailFile
\param addr_cc email cc
\param addr_bcc email bcc
*/
function
CMailFile
(
$subject
,
$to
,
$from
,
$msg
,
$filename_list
,
$mimetype_list
,
$mimefilename_list
,
$addr_cc
=
""
,
$addr_bcc
=
""
)
function
CMailFile
(
$subject
,
$to
,
$from
,
$msg
,
$filename_list
,
$mimetype_list
,
$mimefilename_list
,
$addr_cc
=
""
,
$addr_bcc
=
""
)
{
$this
->
subject
=
$subject
;
$this
->
addr_from
=
$from
;
...
...
@@ -69,14 +72,14 @@ class CMailFile
}
}
/**
\brief permet d'attacher un fichier
\param filename_list
\param mimetype_list
\param mimefilename_list
*/
function
attach_file
(
$filename_list
,
$mimetype_list
,
$mimefilename_list
)
/**
\brief permet d'attacher un fichier
\param filename_list
\param mimetype_list
\param mimefilename_list
*/
function
attach_file
(
$filename_list
,
$mimetype_list
,
$mimefilename_list
)
{
for
(
$i
=
0
;
$i
<
count
(
$filename_list
);
$i
++
)
{
$encoded
=
$this
->
encode_file
(
$filename_list
[
$i
]);
...
...
@@ -93,12 +96,12 @@ class CMailFile
// added -- to notify email client attachment is done
}
/**
\brief permet d'encoder un fichier
\param sourcefile
*/
function
encode_file
(
$sourcefile
)
/**
\brief permet d'encoder un fichier
\param sourcefile
*/
function
encode_file
(
$sourcefile
)
{
// print "<pre> on encode $sourcefile </pre>\n";
if
(
is_readable
(
$sourcefile
))
...
...
@@ -111,24 +114,22 @@ class CMailFile
return
$encoded
;
}
/**
\brief permet d'envoyer un fichier
*/
function
sendfile
()
/**
\brief permet d'envoyer un fichier
*/
function
sendfile
()
{
$headers
.
=
$this
->
smtp_headers
.
$this
->
mime_headers
;
$message
=
$this
->
text_body
.
$this
->
text_encoded
;
return
mail
(
$this
->
addr_to
,
$this
->
subject
,
stripslashes
(
$message
),
$headers
);
}
/**
\brief permet d'ecrire le body d'un message
\param msgtext
\param filename_list
*/
function
write_body
(
$msgtext
,
$filename_list
)
/**
\brief permet d'ecrire le body d'un message
\param msgtext
\param filename_list
*/
function
write_body
(
$msgtext
,
$filename_list
)
{
if
(
count
(
$filename_list
))
{
...
...
@@ -140,13 +141,12 @@ class CMailFile
return
$out
;
}
/**
\brief cration des headers mime
\param filename_list
\param mimefilename_list
*/
function
write_mimeheaders
(
$filename_list
,
$mimefilename_list
)
{
/**
\brief cration des headers mime
\param filename_list
\param mimefilename_list
*/
function
write_mimeheaders
(
$filename_list
,
$mimefilename_list
)
{
$out
=
"MIME-version: 1.0
\n
"
;
$out
=
$out
.
"Content-type: multipart/mixed; "
;
$out
=
$out
.
"boundary=
\"
$this->mime_boundary
\"\n
"
;
...
...
@@ -158,14 +158,10 @@ class CMailFile
return
$out
;
}
/**
\brief cration des headers smtp
\param addr_from
\param addr_cc
\param addr_bcc
*/
function
write_smtpheaders
()
/**
\brief cration des headers smtp
*/
function
write_smtpheaders
()
{
$out
=
"From: "
.
$this
->
addr_from
.
"
\n
"
;
if
(
$this
->
addr_cc
)
$out
=
$out
.
"Cc: "
.
$this
->
addr_cc
.
"
\n
"
;
...
...
@@ -177,22 +173,16 @@ class CMailFile
$out
=
$out
.
"Return-path:
$addr_from
\n
"
;
return
$out
;
}
}
/**
\brief permet de diviser une chaine (RFC2045)
\param str
\remarks function chunk_split qui remplace celle de php si ncssaire
\remarks 76 caractres par ligne, termin par "\r\n"
*/
// usage - mimetype example "image/gif"
// $mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filename,$mimetype);
// $mailfile->sendfile();
// Splits a string by RFC2045 semantics (76 chars per line, end with \r\n).
// This is not in all PHP versions so I define one here manuall.
function
my_chunk_split
(
$str
)
{
$stmp
=
$str
;
...
...
@@ -212,5 +202,5 @@ function my_chunk_split($str)
return
$out
;
}
// end script
?>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment