Adding additional headers
The addHeader() method can be used to set additional headers with its first two arguments being the name and
value pair of the header and a third boolean argument to indicate whether there will be multiple vaues for the
header. The requested priority indication is an additional header that appears in the email as a name:value pair
like so:
X-Priority: 2
We were clever enough to have preempted this requirement and designed our database field to contain an
integer to correspond with the value of the priority. Adding this value as a header is now simple enough:
$mail->addHeader('X-Priority', $supportIssue->current()->priority, false);
The arguments now specify that we are adding a header with the name ???X-Priority??™, the priority value
chosen for the current support ticket and that it is just a single value. The received email should then have an
???at-a-glance??? indication of its priority depending on whether the email client used recognises the priority
header or not.
9.3.4 Adding attachments to the support email
It would be a safe bet to say that there won??™t be a single developer reading this book that hasn??™t had bug
reports with descriptions as vague as ???it??™s broken??? or ???it??™s not working??? and narrowing down the actual
problem can occasionally be more frustrating than actually fixing it.
Pages:
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261