Skip to content

Commit

Permalink
[enhance] smtpClient: change X-Mailer header, with a version number
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederic Ye committed Mar 1, 2012
1 parent 4a6f876 commit 83fe19c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions libnet/_tags
Expand Up @@ -11,6 +11,7 @@ true: warn_A, warn_e, warn_error_A

<http_common.ml>: use_buildinfos
<httpServerCore.ml>: use_buildinfos
<smtpClient.ml>: use_buildinfos

<http*.ml>: with_mlstate_debug
<hlnet.*>: with_mlstate_debug
Expand Down
6 changes: 4 additions & 2 deletions libnet/smtpClient.ml
Expand Up @@ -26,6 +26,8 @@ let (<|) f a = f a
let (|>) a f = f a
let ( @* ) g f x = g(f(x))

let mailer_name = Printf.sprintf "Opa-mailclient/%d" BuildInfos.git_version_counter

let sprintf = Printf.sprintf

let _log sep code reason = Logger.warning "%d%s%s" code sep reason
Expand Down Expand Up @@ -158,13 +160,13 @@ let full_email ?(subject="") mfrom mto mdata ?return_path ?html ?(files=[]) ?(cu
To: %s\r\n\
Return-Path:<%s>\r\n\
Message-ID: <%s.%s>\r\n\
X-Mailer: MLstate mailclient\r\n\
X-Mailer: %s\r\n\
Date: %s\r\n\
Mime-Version: 1.0\r\n\
%s\
%s\
%s"
mfrom mto return_path (String.random 10) return_path (Date.rfc1123 (Time.gmtime (Time.now())))
mfrom mto return_path (String.random 10) return_path mailer_name (Date.rfc1123 (Time.gmtime (Time.now())))
(if subject = "" then "" else sprintf "Subject: %s\r\n" subject)
(attach_custom_headers custom_headers)
(if files = []
Expand Down

0 comments on commit 83fe19c

Please sign in to comment.