You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

additional-mail.php 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016 Arthur Schiwon <blizzz@arthur-schiwon.de>
  4. *
  5. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  6. *
  7. * @license GNU AGPL version 3 or any later version
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License as
  11. * published by the Free Software Foundation, either version 3 of the
  12. * License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. */
  23. /** @var \OCP\IL10N $l */
  24. /** @var array $_ */
  25. $mail_smtpsecure = [
  26. '' => $l->t('None'),
  27. 'ssl' => $l->t('SSL/TLS')
  28. ];
  29. $mail_smtpmode = [
  30. ['smtp', 'SMTP'],
  31. ];
  32. if ($_['sendmail_is_available']) {
  33. $mail_smtpmode[] = ['sendmail', 'Sendmail'];
  34. }
  35. if ($_['mail_smtpmode'] === 'qmail') {
  36. $mail_smtpmode[] = ['qmail', 'qmail'];
  37. }
  38. $mail_sendmailmode = [
  39. 'smtp' => 'smtp (-bs)',
  40. 'pipe' => 'pipe (-t)'
  41. ];
  42. ?>
  43. <div class="section" id="mail_general_settings">
  44. <form id="mail_general_settings_form" class="mail_settings">
  45. <h2><?php p($l->t('Email server'));?></h2>
  46. <a target="_blank" rel="noreferrer noopener" class="icon-info"
  47. title="<?php p($l->t('Open documentation'));?>"
  48. href="<?php p(link_to_docs('admin-email')); ?>"></a>
  49. <p class="settings-hint"><?php p($l->t('It is important to set up this server to be able to send emails, like for password reset and notifications.')); ?></p>
  50. <p><span id="mail_settings_msg" class="msg"></span></p>
  51. <p>
  52. <label for="mail_smtpmode"><?php p($l->t('Send mode')); ?></label>
  53. <select name="mail_smtpmode" id="mail_smtpmode">
  54. <?php foreach ($mail_smtpmode as $smtpmode):
  55. $selected = '';
  56. if ($smtpmode[0] == $_['mail_smtpmode']):
  57. $selected = 'selected="selected"';
  58. endif; ?>
  59. <option value="<?php p($smtpmode[0])?>" <?php p($selected) ?>><?php p($smtpmode[1]) ?></option>
  60. <?php endforeach;?>
  61. </select>
  62. <label id="mail_smtpsecure_label" for="mail_smtpsecure"
  63. <?php if ($_['mail_smtpmode'] !== 'smtp') {
  64. print_unescaped(' class="hidden"');
  65. } ?>>
  66. <?php p($l->t('Encryption')); ?>
  67. </label>
  68. <select name="mail_smtpsecure" id="mail_smtpsecure"
  69. <?php if ($_['mail_smtpmode'] !== 'smtp') {
  70. print_unescaped(' class="hidden"');
  71. } ?>>
  72. <?php foreach ($mail_smtpsecure as $secure => $name):
  73. $selected = '';
  74. if ($secure == $_['mail_smtpsecure']):
  75. $selected = 'selected="selected"';
  76. endif; ?>
  77. <option value="<?php p($secure)?>" <?php p($selected) ?>><?php p($name) ?></option>
  78. <?php endforeach;?>
  79. </select>
  80. <label id="mail_sendmailmode_label" for="mail_sendmailmode" class="<?= $_['mail_smtpmode'] !== 'sendmail' ? 'hidden' : '' ?>">
  81. <?php p($l->t('Sendmail mode')); ?>
  82. </label>
  83. <select name="mail_sendmailmode" id="mail_sendmailmode" class="<?= $_['mail_smtpmode'] !== 'sendmail' ? 'hidden' : '' ?>">
  84. <?php foreach ($mail_sendmailmode as $sendmailmodeValue => $sendmailmodeLabel): ?>
  85. <option value="<?php p($sendmailmodeValue)?>" <?= $sendmailmodeValue === $_['mail_sendmailmode'] ? 'selected="selected"' : '' ?>><?php p($sendmailmodeLabel) ?></option>
  86. <?php endforeach;?>
  87. </select>
  88. </p>
  89. <p>
  90. <label for="mail_from_address"><?php p($l->t('From address')); ?></label>
  91. <input type="text" name="mail_from_address" id="mail_from_address" placeholder="<?php p($l->t('Email'))?>"
  92. value="<?php p($_['mail_from_address']) ?>" />@
  93. <input type="text" name="mail_domain" id="mail_domain" placeholder="example.com"
  94. value="<?php p($_['mail_domain']) ?>" />
  95. </p>
  96. <!--lo-->
  97. <p id="setting_smtphost" <?php if ($_['mail_smtpmode'] !== 'smtp') {
  98. print_unescaped(' class="hidden"');
  99. } ?>>
  100. <label for="mail_smtphost"><?php p($l->t('Server address')); ?></label>
  101. <input type="text" name="mail_smtphost" id="mail_smtphost" placeholder="smtp.example.com"
  102. value="<?php p($_['mail_smtphost']) ?>" />
  103. :
  104. <input type="text" inputmode="numeric" name="mail_smtpport" id="mail_smtpport" placeholder="<?php p($l->t('Port'))?>"
  105. value="<?php p($_['mail_smtpport']) ?>" />
  106. </p>
  107. </form>
  108. <form class="mail_settings" id="mail_credentials_settings">
  109. <p id="mail_credentials" <?php if ($_['mail_smtpmode'] !== 'smtp') {
  110. print_unescaped(' class="hidden"');
  111. } ?>>
  112. <label for="mail_smtpname"><?php p($l->t('Credentials')); ?></label>
  113. <input type="text" name="mail_smtpname" id="mail_smtpname" placeholder="<?php p($l->t('SMTP Username'))?>"
  114. value="<?php p($_['mail_smtpname']) ?>" />
  115. <input type="text" name="mail_smtppassword" id="mail_smtppassword" autocomplete="off"
  116. placeholder="<?php p($l->t('SMTP Password'))?>" value="<?php p($_['mail_smtppassword']) ?>" />
  117. <input id="mail_credentials_settings_submit" type="button" value="<?php p($l->t('Save')) ?>">
  118. </p>
  119. </form>
  120. <br />
  121. <em><?php p($l->t('Test and verify email settings')); ?></em>
  122. <input type="submit" name="sendtestemail" id="sendtestemail" value="<?php p($l->t('Send email')); ?>"/>
  123. <span id="sendtestmail_msg" class="msg"></span>
  124. </div>