Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Perun
Perun ProxyIdP
v1
simplesamlphp
Commits
fd9bf496
Unverified
Commit
fd9bf496
authored
7 years ago
by
Tim van Dijen
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
PSR-2
+ phpdoc
parent
a8f60543
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/SimpleSAML/XHTML/EMail.php
+38
-18
38 additions, 18 deletions
lib/SimpleSAML/XHTML/EMail.php
with
38 additions
and
18 deletions
lib/SimpleSAML/XHTML/EMail.php
+
38
−
18
View file @
fd9bf496
...
...
@@ -6,22 +6,22 @@
* @author Andreas kre Solberg, UNINETT AS. <andreas.solberg@uninett.no>
* @package SimpleSAMLphp
*/
class
SimpleSAML_XHTML_EMail
{
private
$to
=
NULL
;
private
$cc
=
NULL
;
private
$body
=
NULL
;
private
$from
=
NULL
;
private
$replyto
=
NULL
;
private
$subject
=
NULL
;
class
SimpleSAML_XHTML_EMail
{
private
$to
=
null
;
private
$cc
=
null
;
private
$body
=
null
;
private
$from
=
null
;
private
$replyto
=
null
;
private
$subject
=
null
;
private
$headers
=
array
();
/**
* Constructor
*/
function
__construct
(
$to
,
$subject
,
$from
=
NULL
,
$cc
=
NULL
,
$replyto
=
NULL
)
{
public
function
__construct
(
$to
,
$subject
,
$from
=
null
,
$cc
=
null
,
$replyto
=
null
)
{
$this
->
to
=
$to
;
$this
->
cc
=
$cc
;
$this
->
from
=
$from
;
...
...
@@ -29,10 +29,20 @@ class SimpleSAML_XHTML_EMail {
$this
->
subject
=
$subject
;
}
function
setBody
(
$body
)
{
/*
* @param string $body
* @return void
*/
public
function
setBody
(
$body
)
{
$this
->
body
=
$body
;
}
/*
* @param string $body
* @return void
*/
private
function
getHTML
(
$body
)
{
return
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
...
...
@@ -60,10 +70,19 @@ pre {
</html>'
;
}
function
send
()
{
if
(
$this
->
to
==
NULL
)
throw
new
Exception
(
'EMail field [to] is required and not set.'
);
if
(
$this
->
subject
==
NULL
)
throw
new
Exception
(
'EMail field [subject] is required and not set.'
);
if
(
$this
->
body
==
NULL
)
throw
new
Exception
(
'EMail field [body] is required and not set.'
);
/*
* @return void
*/
public
function
send
()
{
if
(
$this
->
to
===
null
)
{
throw
new
Exception
(
'EMail field [to] is required and not set.'
);
}
elseif
(
$this
->
subject
===
null
)
{
throw
new
Exception
(
'EMail field [subject] is required and not set.'
);
}
elseif
(
$this
->
body
===
null
)
{
throw
new
Exception
(
'EMail field [body] is required and not set.'
);
}
$random_hash
=
bin2hex
(
openssl_random_pseudo_bytes
(
16
));
...
...
@@ -93,7 +112,8 @@ Content-Transfer-Encoding: 8bit
$mail_sent
=
@
mail
(
$this
->
to
,
$this
->
subject
,
$message
,
$headers
);
SimpleSAML\Logger
::
debug
(
'Email: Sending e-mail to ['
.
$this
->
to
.
'] : '
.
(
$mail_sent
?
'OK'
:
'Failed'
));
if
(
!
$mail_sent
)
throw
new
Exception
(
'Error when sending e-mail'
);
if
(
!
$mail_sent
)
{
throw
new
Exception
(
'Error when sending e-mail'
);
}
}
}
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