forked from ActiveCampaign/postmark-wordpress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage-settings.php
150 lines (137 loc) · 6.37 KB
/
page-settings.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
<script>
var postmark = postmark || {};
postmark.settings = <?php echo json_encode( $this->settings ); ?>;
</script>
<script src="<?php echo POSTMARK_URL; ?>/assets/js/admin.js"></script>
<link href="<?php echo POSTMARK_URL; ?>/assets/css/admin.css" rel="stylesheet">
<?php wp_nonce_field( 'postmark_nonce' ); ?>
<div class="wrap">
<div class="logo-bar">
<a href="https://postmarkapp.com/" target="_blank"><img src="<?php echo POSTMARK_URL; ?>/assets/images/logo.png" width="130" height="21" alt="" /></a>
</div>
<h1 class="nav-tab-wrapper">
<a class="nav-tab" rel="general">General</a>
<a class="nav-tab" rel="test">Send Test Email</a>
<a class="nav-tab" rel="overrides">Overrides</a>
<?php if ( isset($_ENV['POSTMARK_PLUGIN_TESTING']) && 'POSTMARK_PLUGIN_TESTING' == $_ENV['POSTMARK_PLUGIN_TESTING'] ) : ?>
<a class="nav-tab" rel="plugin-testing">Plugin Testing</a>
<?php endif; ?>
</h1>
<div class="updated notice pm-notice hidden"></div>
<div class="tab-content tab-general">
<table class="form-table" style="max-width:740px;">
<tr>
<th><label>Enabled?</label></th>
<td>
<input type="checkbox" class="pm-enabled" value="1" />
<span class="footnote">Send emails using Postmark</span>
</td>
</tr>
<tr>
<th><label>Use test key?</label></th>
<td>
<input type="checkbox" class="pm-test" value="1" />
<span class="footnote">Use test key (prevents emails from being send but still override wp_mail)</span>
</td>
</tr>
<tr>
<th><label>API Key</label></th>
<td>
<input type="text" class="pm-api-key" value="" />
<div class="footnote">Your API key is in the <strong>Credentials</strong> screen of your <a href="https://account.postmarkapp.com/servers" target="_blank">Postmark Server</a>.</div>
</td>
</tr>
<tr>
<th><label>Sender Email</label></th>
<td>
<input type="text" class="pm-sender-address" value="" />
<div class="footnote">This email must be a verified <a href="https://account.postmarkapp.com/signatures" target="_blank">Sender Signature</a>. It will appear as the "from" address on all outbound emails.</div>
</td>
</tr>
<tr>
<th><label>Force HTML</label></th>
<td>
<input type="checkbox" class="pm-force-html" value="1" />
<span class="footnote">Force emails to be sent as HTML.</span>
</td>
</tr>
<tr>
<th><label>Track Opens</label></th>
<td>
<input type="checkbox" class="pm-track-opens" value="1" />
<span class="footnote">Track email opens (<code>Force HTML</code> is required).</span>
</td>
</tr>
</table>
<div class="submit">
<input type="submit" class="button-primary save-settings" value="Save Changes" />
</div>
</div>
<div class="tab-content tab-test">
<table class="form-table">
<tr>
<th><label>To</label></th>
<td><input type="text" class="pm-test-email" value="" placeholder="[email protected]" /></td>
</tr>
<tr>
<th><label>From (optional)</label></th>
<td><input type="text" class="pm-test-email-sender" value="" placeholder="[email protected]" /></td>
</tr>
<tr>
<td colspan="2"><input type="checkbox" name="with_tracking_and_html" class="pm-test-with-opens" value="" />Send test as HTML, with Open Tracking enabled.</td>
</tr>
</table>
<div class="submit">
<input type="submit" class="button-primary send-test" value="Send Test Email" />
</div>
</div>
<div class="tab-content tab-overrides">
<h2>Developer overrides</h2>
<p>Instead of using <code>Force HTML</code>, we recommend setting <code>wp_mail</code> headers when possible.</p>
<pre>
$headers = array();
// Override the default 'From' address
$headers['From'] = '[email protected]';
// Send the message as HTML
$headers['Content-Type'] = 'text/html';
// Enable open tracking (requires HTML email enabled)
$headers['X-PM-Track-Opens'] = true;
// Send the email
$response = wp_mail( $to, $subject, $message, $headers );
</pre>
To learn more about <code>wp_mail</code>, see the <a href="https://developer.wordpress.org/reference/functions/wp_mail/">WordPress Codex page.</a>
</div>
<?php if ( isset($_ENV['POSTMARK_PLUGIN_TESTING']) &&'POSTMARK_PLUGIN_TESTING' == $_ENV['POSTMARK_PLUGIN_TESTING'] ) : ?>
<div class="tab-content tab-plugin-testing">
<table class="form-table" style="max-width:740px;">
<tr>
<th><label>Headers</label></th>
<td>
<textarea name="pm-plugin-test-headers" class="pm-plugin-test-headers" cols=80 placeholder="Reply-To: [email protected]"></textarea>
</td>
</tr>
<tr>
<th><label>Subject</label></th>
<td>
<input type="text" name="pm-plugin-test-subject" class="pm-plugin-test-subject" placeholder="Dear Emily, I just wanted to say hello..."/>
</td>
</tr>
<tr>
<th><label>Body</label></th>
<td>
<textarea name="pm-plugin-test-body" class="pm-plugin-test-body" placeholder="Hi there!" cols=80 ></textarea>
</td>
</tr>
<tr>
<th><label>To Address</label></th>
<td>
<input type="text" name="pm-plugin-test-to-address" class="pm-plugin-test-to-address" value="" placeholder="[email protected]" />
</td>
</tr>
</table>
<div class="submit">
<input type="submit" class="button-primary plugin-send-test" value="Send Test Message" />
</div>
</div>
<?php endif; ?>
</div>