-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreview_mail.php
168 lines (136 loc) · 3.72 KB
/
review_mail.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<?php
die('Already called!!');
include 'phpmailer/PHPMailerAutoload.php';
date_default_timezone_set('utc');
include 'simplexlsx/simplexlsx.class.php';
$xlsx = new SimpleXLSX('talks_bios.xlsx');
foreach( $xlsx->rows() as $line => $row) {
if ($line === 0){
continue;
}
$speaker1 = trim($row[0]);
$speaker2 = trim($row[1]);
$speaker3 = trim($row[2]);
$topic = trim($row[3]);
$titleSpeech = trim($row[4]);
$abstract = trim($row[5]);
$bio1 = trim($row[6]);
$bio2 = trim($row[7]);
$bio3 = trim($row[8]);
$jobDesc1 = trim($row[9]);
$jobDesc2 = trim($row[10]);
$jobDesc3 = trim($row[11]);
$day = trim($row[12]);
$start = trim($row[13]);
$end = trim($row[14]);
$mail1 = trim($row[15]);
$mail2 = trim($row[16]);
$mail3 = trim($row[17]);
// skip i.e. lightning talks
if( $mail1 === '' ) {
continue;
}
// fill some fields depending on the number of speakers
if ( $jobDesc1 === '' ){
$jobDesc1 = 'Unknown job description, please provide';
}
if ( $speaker2 !== '' ){
if( $jobDesc2 === '' ) {
$jobDesc2 = 'Unknown job description, please provide';
}
}
if ( $speaker3 !== '' ){
if( $jobDesc3 === '' ) {
$jobDesc3 = 'Unknown job description, please provide';
}
}
// Generate speaker list
$speakerList = sprintf('%s (%s)', $speaker1, $jobDesc1);
if( $speaker2 !== '') {
$speakerList = sprintf("%s\n%s (%s)", $speakerList, $speaker2, $jobDesc2);
}
if( $speaker3 !== '') {
$speakerList = sprintf("%s\n%s (%s)", $speakerList, $speaker3, $jobDesc3);
}
$bios = sprintf('Bio 1: %s', $bio1);
if( $bio2 != '') {
$bios = sprintf("%s\n\nBio 2: %s", $bios, $bio2);
}
if( $bio3 != '') {
$bios = sprintf("%s\n\nBio 3: %s", $bios, $bio3);
}
$date = sprintf('%s from: %s ~ to: %s', $day, $start, $end);
$subject = 'LibO Conf Bern - please check your speech details';
$text = sprintf(
"Hi :)
We're working on the conference booklet for the LibreOffice conference in Bern
and this is the information we will print about your speech.
Please check if everything is okay and send corrections back to me
([email protected]) until 2014-08-12.
IMPORTANT: Please also send me a picture we can print together with your bio.
Thanks for your help and see you in September :)
Speaker list (with job description - please provide if missing)
===============================================================
%s
Topic (FYI)
============
%s
Title of your speech
====================
%s
Abstract
========
%s
Bio of speaker(s)
=================
%s
Date of speech
==============
%s
Please don't forget to send a picture.
Kind regards,
Nicolas
--
Nicolas Christener | [email protected] | +41 76 335 32 57
Verein Swiss Open Systems User Group /ch/open
Belegscanning, 10073 | Postfach | CH-6009 Luzern | http://www.ch-open.ch",
$speakerList,
$topic,
$titleSpeech,
$abstract,
$bios,
$date
);
// Send mail
$mail = new PHPMailer();
$mail->IsSMTP(); // use SMTP
// SMTP Configuration
$mail->SMTPAuth = true;
$mail->Host = "mail.syhosting.ch";
$mail->Username = "";
$mail->Password = "";
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->CharSet = 'UTF-8';
$mail->FromName = "Nicolas Christener";
$mail->Subject = $subject;
$mail->Body = $text;
$mail->IsHTML(false);
$mail->AddAddress($mail1);
if( $mail2 !== '' ){
$mail->AddAddress($mail2);
}
if( $mail3 !== '' ){
$mail->AddAddress($mail3);
}
//$mail->AddCC('[email protected]', 'Firstname Lastname');
//$mail->AddBCC('[email protected]', 'Firstname Lastname');
$response = NULL;
if(!$mail->Send()) {
$response = "Mailer Error: " . $mail->ErrorInfo;
}
else {
$response = "Message sent!";
}
}