mirror of
https://github.com/pierre42100/comunic
synced 2025-06-20 09:05:21 +00:00
First commit
This commit is contained in:
5
3rdparty/phpmailer/test/bootstrap.php
vendored
Executable file
5
3rdparty/phpmailer/test/bootstrap.php
vendored
Executable file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
require_once 'vendor/autoload.php';
|
||||
spl_autoload_register(function ($class) {
|
||||
require_once strtr($class, '\\_', '//').'.php';
|
||||
});
|
125
3rdparty/phpmailer/test/fakepopserver.sh
vendored
Executable file
125
3rdparty/phpmailer/test/fakepopserver.sh
vendored
Executable file
@ -0,0 +1,125 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Fake POP3 server
|
||||
# By Marcus Bointon <phpmailer@synchromedia.co.uk>
|
||||
# Based on code by 'Frater' found at http://www.linuxquestions.org/questions/programming-9/fake-pop3-server-to-capture-pop3-passwords-933733
|
||||
# Does not actually serve any mail, but supports commands sufficient to test POP-before SMTP
|
||||
# Can be run directly from a shell like this:
|
||||
# mkfifo fifo; nc -l 1100 <fifo |./fakepopserver.sh >fifo; rm fifo
|
||||
# It will accept any user name and will return a positive response for the password 'test'
|
||||
|
||||
# Licensed under the GNU Lesser General Public License: http://www.gnu.org/copyleft/lesser.html
|
||||
|
||||
# Enable debug output
|
||||
#set -xv
|
||||
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
|
||||
|
||||
LOGFOLDER=/tmp
|
||||
|
||||
LOGFILE=${LOGFOLDER}/fakepop.log
|
||||
|
||||
LOGGING=1
|
||||
DEBUG=1
|
||||
TIMEOUT=60
|
||||
|
||||
POP_USER=
|
||||
POP_PASSWRD=test
|
||||
|
||||
LINES=1
|
||||
BREAK=0
|
||||
|
||||
write_log () {
|
||||
if [ ${LINES} -eq 1 ] ; then
|
||||
echo '---' >>${LOGFILE}
|
||||
fi
|
||||
let LINES+=1
|
||||
[ ${LOGGING} = 0 ] || echo -e "`date '+%b %d %H:%M'` pop3 $*" >>${LOGFILE}
|
||||
}
|
||||
|
||||
ANSWER="+OK Fake POP3 Service Ready"
|
||||
|
||||
while [ ${BREAK} -eq 0 ] ; do
|
||||
echo -en "${ANSWER}\r\n"
|
||||
|
||||
REPLY=""
|
||||
|
||||
#Input appears in $REPLY
|
||||
read -t ${TIMEOUT}
|
||||
|
||||
ANSWER="+OK "
|
||||
COMMAND=""
|
||||
ARGS=""
|
||||
TIMEOUT=30
|
||||
|
||||
if [ "$REPLY" ] ; then
|
||||
write_log "RAW input: '`echo "${REPLY}" | tr -cd '[ -~]'`'"
|
||||
|
||||
COMMAND="`echo "${REPLY}" | awk '{print $1}' | tr -cd '\40-\176' | tr 'a-z' 'A-Z'`"
|
||||
ARGS="`echo "${REPLY}" | tr -cd '\40-\176' | awk '{for(i=2;i<=NF;i++){printf "%s ", $i};printf "\n"}' | sed 's/ $//'`"
|
||||
|
||||
write_log "Command: \"${COMMAND}\""
|
||||
write_log "Arguments: \"${ARGS}\""
|
||||
|
||||
case "$COMMAND" in
|
||||
QUIT)
|
||||
break
|
||||
;;
|
||||
USER)
|
||||
if [ -n "${ARGS}" ] ; then
|
||||
POP_USER="${ARGS}"
|
||||
ANSWER="+OK Please send PASS command"
|
||||
fi
|
||||
;;
|
||||
AUTH)
|
||||
ANSWER="+OK \r\n."
|
||||
;;
|
||||
CAPA)
|
||||
ANSWER="+OK Capabilities include\r\nUSER\r\nCAPA\r\n."
|
||||
;;
|
||||
PASS)
|
||||
if [ "${POP_PASSWRD}" == "${ARGS}" ] ; then
|
||||
ANSWER="+OK Logged in."
|
||||
AUTH=1
|
||||
else
|
||||
ANSWER="-ERR Login failed."
|
||||
fi
|
||||
;;
|
||||
LIST)
|
||||
if [ "${AUTH}" = 0 ] ; then
|
||||
ANSWER="-ERR Not authenticated"
|
||||
else
|
||||
if [ -z "${ARGS}" ] ; then
|
||||
ANSWER="+OK No messages, really\r\n."
|
||||
else
|
||||
ANSWER="-ERR No messages, no list, no status"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
RSET)
|
||||
ANSWER="+OK Resetting or whatever\r\n."
|
||||
;;
|
||||
LAST)
|
||||
if [ "${AUTH}" = 0 ] ; then
|
||||
ANSWER="-ERR Not authenticated"
|
||||
else
|
||||
ANSWER="+OK 0"
|
||||
fi
|
||||
;;
|
||||
STAT)
|
||||
if [ "${AUTH}" = 0 ] ; then
|
||||
ANSWER="-ERR Not authenticated"
|
||||
else
|
||||
ANSWER="+OK 0 0"
|
||||
fi
|
||||
;;
|
||||
NOOP)
|
||||
ANSWER="+OK Hang on, doing nothing"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo "+OK Connection timed out"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
echo "+OK Bye!\r\n"
|
22
3rdparty/phpmailer/test/fakesendmail.sh
vendored
Executable file
22
3rdparty/phpmailer/test/fakesendmail.sh
vendored
Executable file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
#Fake sendmail script, adapted from:
|
||||
#https://github.com/mrded/MNPP/blob/ee64fb2a88efc70ba523b78e9ce61f9f1ed3b4a9/init/fake-sendmail.sh
|
||||
|
||||
#Create a temp folder to put messages in
|
||||
numPath="${TMPDIR-/tmp/}fakemail"
|
||||
umask 037
|
||||
mkdir -p $numPath
|
||||
|
||||
if [ ! -f $numPath/num ]; then
|
||||
echo "0" > $numPath/num
|
||||
fi
|
||||
num=`cat $numPath/num`
|
||||
num=$(($num + 1))
|
||||
echo $num > $numPath/num
|
||||
|
||||
name="$numPath/message_$num.eml"
|
||||
while read line
|
||||
do
|
||||
echo $line >> $name
|
||||
done
|
||||
exit 0
|
76
3rdparty/phpmailer/test/phpmailerLangTest.php
vendored
Executable file
76
3rdparty/phpmailer/test/phpmailerLangTest.php
vendored
Executable file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/**
|
||||
* PHPMailer - language file tests
|
||||
* Requires PHPUnit 3.3 or later.
|
||||
*
|
||||
* PHP version 5.0.0
|
||||
*
|
||||
* @package PHPMailer
|
||||
* @author Andy Prevost
|
||||
* @author Marcus Bointon <phpmailer@synchromedia.co.uk>
|
||||
* @copyright 2004 - 2009 Andy Prevost
|
||||
* @copyright 2010 Marcus Bointon
|
||||
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
|
||||
*/
|
||||
|
||||
require_once '../PHPMailerAutoload.php';
|
||||
|
||||
/**
|
||||
* PHPMailer - PHP email transport unit test class
|
||||
* Performs authentication tests
|
||||
*/
|
||||
class PHPMailerLangTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Holds a phpmailer instance.
|
||||
* @private
|
||||
* @var PHPMailer
|
||||
*/
|
||||
public $Mail;
|
||||
|
||||
/**
|
||||
* @var string Default include path
|
||||
*/
|
||||
public $INCLUDE_DIR = '../';
|
||||
|
||||
/**
|
||||
* Run before each test is started.
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
$this->Mail = new PHPMailer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test language files for missing and excess translations
|
||||
* All languages are compared with English
|
||||
* @group languages
|
||||
*/
|
||||
public function testTranslations()
|
||||
{
|
||||
$this->Mail->setLanguage('en');
|
||||
$definedStrings = $this->Mail->getTranslations();
|
||||
$err = '';
|
||||
foreach (new DirectoryIterator('../language') as $fileInfo) {
|
||||
if ($fileInfo->isDot()) {
|
||||
continue;
|
||||
}
|
||||
$matches = array();
|
||||
//Only look at language files, ignore anything else in there
|
||||
if (preg_match('/^phpmailer\.lang-([a-z_]{2,})\.php$/', $fileInfo->getFilename(), $matches)) {
|
||||
$lang = $matches[1]; //Extract language code
|
||||
$PHPMAILER_LANG = array(); //Language strings get put in here
|
||||
include $fileInfo->getPathname(); //Get language strings
|
||||
$missing = array_diff(array_keys($definedStrings), array_keys($PHPMAILER_LANG));
|
||||
$extra = array_diff(array_keys($PHPMAILER_LANG), array_keys($definedStrings));
|
||||
if (!empty($missing)) {
|
||||
$err .= "\nMissing translations in $lang: " . implode(', ', $missing);
|
||||
}
|
||||
if (!empty($extra)) {
|
||||
$err .= "\nExtra translations in $lang: " . implode(', ', $extra);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->assertEmpty($err, $err);
|
||||
}
|
||||
}
|
1437
3rdparty/phpmailer/test/phpmailerTest.php
vendored
Executable file
1437
3rdparty/phpmailer/test/phpmailerTest.php
vendored
Executable file
File diff suppressed because it is too large
Load Diff
10
3rdparty/phpmailer/test/runfakepopserver.sh
vendored
Executable file
10
3rdparty/phpmailer/test/runfakepopserver.sh
vendored
Executable file
@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Run the fake pop server from bash
|
||||
# Idea from http://blog.ale-re.net/2007/09/ipersimple-remote-shell-with-netcat.html
|
||||
# Defaults to port 1100 so it can be run by unpriv users and not clash with a real server
|
||||
# Optionally, pass in in a port number as the first arg
|
||||
|
||||
mkfifo fifo
|
||||
nc -l ${1:-1100} <fifo |bash ./fakepopserver.sh >fifo
|
||||
rm fifo
|
81
3rdparty/phpmailer/test/test_callback.php
vendored
Executable file
81
3rdparty/phpmailer/test/test_callback.php
vendored
Executable file
@ -0,0 +1,81 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>PHPMailer Lite - DKIM and Callback Function test</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
/* This is a sample callback function for PHPMailer Lite.
|
||||
* This callback function will echo the results of PHPMailer processing.
|
||||
*/
|
||||
|
||||
/* Callback (action) function
|
||||
* boolean $result result of the send action
|
||||
* string $to email address of the recipient
|
||||
* string $cc cc email addresses
|
||||
* string $bcc bcc email addresses
|
||||
* string $subject the subject
|
||||
* string $body the email body
|
||||
* @return boolean
|
||||
*/
|
||||
function callbackAction($result, $to, $cc, $bcc, $subject, $body)
|
||||
{
|
||||
/*
|
||||
this callback example echos the results to the screen - implement to
|
||||
post to databases, build CSV log files, etc., with minor changes
|
||||
*/
|
||||
$to = cleanEmails($to, 'to');
|
||||
$cc = cleanEmails($cc[0], 'cc');
|
||||
$bcc = cleanEmails($bcc[0], 'cc');
|
||||
echo $result . "\tTo: " . $to['Name'] . "\tTo: " . $to['Email'] . "\tCc: " . $cc['Name'] .
|
||||
"\tCc: " . $cc['Email'] . "\tBcc: " . $bcc['Name'] . "\tBcc: " . $bcc['Email'] .
|
||||
"\t" . $subject . "\n\n". $body . "\n";
|
||||
return true;
|
||||
}
|
||||
|
||||
require_once '../class.phpmailer.php';
|
||||
$mail = new PHPMailer();
|
||||
|
||||
try {
|
||||
$mail->isMail();
|
||||
$mail->setFrom('you@example.com', 'Your Name');
|
||||
$mail->addAddress('another@example.com', 'John Doe');
|
||||
$mail->Subject = 'PHPMailer Test Subject';
|
||||
$mail->msgHTML(file_get_contents('../examples/contents.html'));
|
||||
// optional - msgHTML will create an alternate automatically
|
||||
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!';
|
||||
$mail->addAttachment('../examples/images/phpmailer.png'); // attachment
|
||||
$mail->addAttachment('../examples/images/phpmailer_mini.png'); // attachment
|
||||
$mail->action_function = 'callbackAction';
|
||||
$mail->send();
|
||||
echo "Message Sent OK</p>\n";
|
||||
} catch (phpmailerException $e) {
|
||||
echo $e->errorMessage(); //Pretty error messages from PHPMailer
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage(); //Boring error messages from anything else!
|
||||
}
|
||||
|
||||
function cleanEmails($str, $type)
|
||||
{
|
||||
if ($type == 'cc') {
|
||||
$addy['Email'] = $str[0];
|
||||
$addy['Name'] = $str[1];
|
||||
return $addy;
|
||||
}
|
||||
if (!strstr($str, ' <')) {
|
||||
$addy['Name'] = '';
|
||||
$addy['Email'] = $addy;
|
||||
return $addy;
|
||||
}
|
||||
$addyArr = explode(' <', $str);
|
||||
if (substr($addyArr[1], -1) == '>') {
|
||||
$addyArr[1] = substr($addyArr[1], 0, -1);
|
||||
}
|
||||
$addy['Name'] = $addyArr[0];
|
||||
$addy['Email'] = $addyArr[1];
|
||||
$addy['Email'] = str_replace('@', '@', $addy['Email']);
|
||||
return $addy;
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
7
3rdparty/phpmailer/test/testbootstrap-dist.php
vendored
Executable file
7
3rdparty/phpmailer/test/testbootstrap-dist.php
vendored
Executable file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
$_REQUEST['submitted'] = 1;
|
||||
$_REQUEST['mail_to'] = 'somebody@example.com';
|
||||
$_REQUEST['mail_from'] = 'phpunit@example.com';
|
||||
$_REQUEST['mail_cc'] = 'cc@example.com';
|
||||
$_REQUEST['mail_host'] = 'localhost';
|
||||
$_REQUEST['mail_port'] = 2500;
|
Reference in New Issue
Block a user