Bagaimana mengubah pengiriman email dengan mengguankan phpmail

If you have root access to your server, you may be able to see the system-level mail log. The location will vary from system to system, but /var/log/maillog is usually a good guess. It will have the most information for debugging mail sent directly through PHP.

One of the challenges of SMTP is that the initial connection is off of your server, so access to logs to help with debugging is very limited.

Do you get the same “Could not authenticate” message when you change the port from 465 to 587?

To debug the SMTP connection, you will need to edit the SMTPMailer.inc.php to add more logging to your PHP error log to discover the source of the SMTP authentication failure. You will need to be comfortable with PHP to do this. We can offer guidance, but can’t give you step-by-step instructions.

oke terima kasih

lalu apa yang harus saya lakukan

saya memiliki akses ke server saya.
tetapi saya belum menemukan lokasi tersebut…bisanya berada dimana ?

If you have root access to your server and are looking for the system’s mail log (or “maillog”), you will probably need to check with a support forum specific to your operating system. The location and configuration of the mail log will vary widely.

Serverfault would be a good starting place:

saya bertanya kepada pihak pengembah server hosting saya tentang masalah menggunakan layanan SMTP SSL , dan mereka menjawab :

Untuk saat ini informasi dari admin pengiriman email dengan SMTP SSL di shared hosting belum tersedia , jadi klien harus mengunakan TLS port 587.

pada dasarnya konfigurasi SMTP dengan TLS 587 sudah tersedia dan berfungsi dengan baik di layanan kami
hanya saja Script SMTP Mail dari OJS tidak menyediakan pengaturan Headder Email
sehingga meskipun sudah mengkonfigurasikan dengan TLS 587 email tetap tidak dapat terkirim

maka dari itu perlu mengkonfirmasi kembali ke pihak Developer OJS, tentang bagaimana cara meng konfiguarsi pengiriman email dengan menggunakan TLS port 587 di script yang mereka kembangkan.
agar dapat kami sesuaikan konfigurasinya

Can you ask your hosting support to clarify what Email Header is expected? OJS using standard SMTP headers, but these can be configured in multiple ways. I don’t understand “hanya saja Script SMTP Mail dari OJS tidak menyediakan pengaturan Headder Email”.

pihak hosting saya mohon untuk mengkonfirmasi kembali ke pihak OJS, tentang bagaimana cara meng konfiguarsi pengiriman email dengan mengguankan TLS port 587, dan apabila menggunakan phpmailer maka konfigurasinya akan nampak seperti berikut :

  • Host : namadomainanda.com // pastikan namadomain terhubung dengan server hostingnya
  • mail->SMTPAuth = true; // aktifkan SMTP authentication
  • mail->SMTPSecure = “tls”;
  • port = 587 ;
  • mail->Username = "apapun@namadomainanda.com "; // username atau alamat email
  • mail->Password = “REMOVED”; // password akun email

Berikan konfiguarsi di atas ke pihak ojs, dan mintalah keterangan bagai mana cara mengimplemnetasikan konfiguarsi tersbeut di sistem mereka, mengingat konfiguarsi tersebut adalah milik phpmailer.
reffrensi phpmailer : GitHub - PHPMailer/PHPMailer: The classic email sending library for PHP

pihak hosting saya mohon untuk mengkonfirmasi kembali ke pihak OJS, tentang bagaimana cara meng konfiguarsi pengiriman email dengan mengguankan TLS port 587, dan apabila menggunakan phpmailer maka konfigurasinya akan nampak seperti berikut :

Host : namadomainanda.com // pastikan namadomain terhubung dengan server hostingnya
mail->SMTPAuth = true; // aktifkan SMTP authentication
mail->SMTPSecure = "tls";
port = 587 ;
mail->Username = "apapun@namadomainanda.com "; // username atau alamat email
mail->Password = "REMOVED"; // password akun email

Berikan konfiguarsi di atas ke pihak ojs, dan mintalah keterangan bagaimana cara mengimplemnetasikan konfiguarsi tersebut di sistem mereka, mengingat konfiguarsi tersebut adalah milik phpmailer.
reffrensi phpmailer : GitHub - PHPMailer/PHPMailer: The classic email sending library for PHP

I’m not sure if the password included in your posts was real, but I removed it. If this was a live password, please be sure to change it.

To configure OJS 2.x with that PHPMailer configuration, I think your config.in.php would look like:

[email]

; Use SMTP for sending mail instead of mail()
smtp = On
; SMTP server settings
smtp_server = "tls://namadomainanda.com"
smtp_port = 587

; Enable SMTP authentication
; Supported mechanisms: PLAIN, LOGIN, CRAM-MD5, and DIGEST-MD5
smtp_auth = PLAIN
smtp_username = "apapun@namadomainanda.com"
smtp_password = "yourPasswordHere"

saya sudah ubah tetapi masih bermasalah :
pada error.log muncul :
[22-May-2017 02:18:21 UTC] OJS SMTPMailer: Could not authenticate

<?php
[email]
; Use SMTP for sending mail instead of mail()
smtp = On

; SMTP server settings
; smtp_server = "tls://smtp.gmail.com"
; smtp_port = 587

; Enable SMTP authentication
; Supported mechanisms: PLAIN, LOGIN, CRAM-MD5, and DIGEST-MD5
smtp_auth = PLAIN
smtp_username = "jurnal.keslingbjb@gmail.com"
smtp_password = "............."

; Allow envelope sender to be specified
; (may not be possible with some server configurations)
allow_envelope_sender = On

; Default envelope sender to use if none is specified elsewhere
default_envelope_sender = jurnal.keslingbjb@gmail.com
?>

Hi @rizki,

Part of your configuration is commented out. Lines beginning with a ; are ignored.

Regards,
Alec Smecher
Public Knowledge Project Team

<?php

[email]
; Use SMTP for sending mail instead of mail()
smtp = On

; SMTP server settings
smtp_server = "TLS://kesling-poltekkesbjm.com"
smtp_port = 587

; Enable SMTP authentication
; Supported mechanisms: PLAIN, LOGIN, CRAM-MD5, and DIGEST-MD5
smtp_auth = PLAIN
smtp_username = "jurnal.keslingbjb@gmail.com"
smtp_password = "j..............."

; Allow envelope sender to be specified
; (may not be possible with some server configurations)
allow_envelope_sender = On

?>

[24-May-2017 00:50:29 UTC] ojs2 has produced an error
Message: WARNING: fsockopen(): unable to connect to TLS://kesling-poltekkesbjm.com:587 (Unable to find the socket transport "TLS" - did you forget to enable it when you configured PHP?)
In file: /home/u3584193/public_html/ojs/lib/pkp/classes/mail/SMTPMailer.inc.php
At line: 134
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.4.45
Apache Version: N/A
DB Driver: mysql
DB server version: 5.5.54-cll

Hi @rizki,

It looks like you changed your transport from tls:// to TLS://. I’m not sure if this is case sensitive, but I’d suggest using tls:// just in case.

Regards,
Alec Smecher
Public Knowledge Project Team

sudah saya ganti dari TLS:// ke tls:// aka tetapi muncul pada error.log

[24-May-2017 07:15:08 UTC] ojs2 has produced an error
Message: WARNING: fsockopen(): unable to connect to tls://
kesling-poltekkesbjm.com:587 (Unknown error)
In file:
/home/u3584193/public_html/ojs/lib/pkp/classes/mail/SMTPMailer.inc.php
At line: 134
Stacktrace:
Server info:
OS: Linux
PHP Version: 5.4.45
Apache Version: N/A
DB Driver: mysql
DB server version: 5.5.54-cll

That level of error indicates that something went wrong when your server tried to open a connection to kesling-poltekkesbjm.com on port 587. OJS didn’t even get a chance to try the SMTP dialog with the kesling-poltekkesbjm.com.

I’ve confirmed that kesling-poltekkesbjm.com is talking to the world on 587; your next step would be to check this connection outside of PHP, and to double check the configuration (that space between tls:// and kesling-poltekkesbjm.com only exists in the error message, not in config.inc.php, right?)