OAuth2�F��SendMail/RcvMail���\�b�h�����s����ɂ͈ȉ��̎菇���K�v�ł��B
basp21p.ini�p�����[�^ | ���O | ���� |
---|---|---|
client_id | �N���C�A���gID | �N���C�A���gID |
client_secret | �N���C�A���g�V�[�N���b�g | �N���C�A���g�V�[�N���b�g |
refresh_token | ���t���b�V���g�[�N�� | ���t���b�V���g�[�N�� |
token_uri | �A�N�Z�X�g�[�N���擾URL | OAuth 2.0 �g�[�N�� �G���h�|�C���g (v2) https://login.microsoftonline.com/�i�e�i���gID�j/oauth2/v2.0/token |
server | office365 SMTP�T�[�o�[ | Smtp.office365.com TLS Smtp.office365.com:587 |
mailfrom | MailFrom | ���M�����[���A�h���X,office365�A�J�E���g�FXOAUTH2 |
popserver | office365 POP�T�[�o�[ | Outlook.office365.com:995 |
basp21p.ini�t�@�C���ɐݒ肪�K�v�ȃp�����[�^���擾���邽�߂�
���F�G���h�|�C���g/�g�[�N���G���h�|�C���g���ďo���܂��B
���̍ۂɃR�}���h�v�����v�g�� curl �R�}���h���g���܂��B
curl �R�}���h�́AWindows 10�ɕW���C���X�g�[������Ă��܂��B
�R�}���h�v�����v�g�� curl -V �Ŋm�F�ł��܂��B
C:\>curl -V curl 7.55.1 (Windows) libcurl/7.55.1 WinSSL Release-Date: [unreleased] Protocols: dict file ftp ftps http https imap imaps pop3 pop3s smtp smtps telnet tftp Features: AsynchDNS IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL C:\>�C���X�g�[������ĂȂ��ꍇ�́A�C���X�g�[�����K�v�ł��B
-86 OAUTH2�F�G���[�B (���O) 2020/11/02 16:20:07.216 3948-6294376 office365(32bit WOW64) RcvMail HTTP > POST /a7a81c19-a273..... 2020/11/02 16:20:07.528 3948-6294376 office365(32bit WOW64) RcvMail HTTP < HTTP/1.1 400 Bad Request 2020/11/02 16:20:07.528 3948-6294376 office365(32bit WOW64) RcvMail ERROR:-52 [SYSTEM]server error HTTP/1.1 400 Bad Request 2020/11/02 16:20:07.528 3948-6294376 office365(32bit WOW64) RcvMail end -86 (842msec) �g�[�N���T�[�o�[�̃A�N�Z�X��HTTP 400�G���[�ƂȂ�܂��B
1. �A�v���P�[�V�����̓o�^�B
�C�ӂ̖��O�ł��܂��܂���B
���_�C���N�gURL�Bhttp://localhost/myapp/�B
2. �N���C�A���gID�ƃe�i���gID���R�s�[�B
3. �N���C�A���g�V�[�N���b�g�쐬���R�s�[
�C�ӂ̐����B�C�ӂ̗L�������B�lj����N���b�N�B
�����łP�N��Q�N���w�肷��Ɗ������
BASP21 Pro ���[���ɂ��SMTP/POP3 �A�N�Z�X�����s���܂��B
���̏ꍇ�A�V�K�ɃN���C�A���g�V�[�N���b�g�쐬���āA
���F�G���h�|�C���g����[�F�R�[�h]���擾����K�v������܂��B
�V�[�N���b�g���R�s�[���܂��B
4. API�̃A�N�Z�X���̒lj�
[API�̃A�N�Z�X����]-[�A�N�Z�X���̒lj�]���N���b�N�B
[Microsoft Grapf]-[�ϔC���ꂽ�A�N�Z�X����]���N���b�N�B
�ȉ��̂R��I�����Ēlj����܂��B
API�A�N�Z�X���̗v���I����@�́A[�A�N�Z�X����I������]�e�L�X�g�{�b�N�X�ɁAOFF �ŃG���^�[�L�[�A �@�@offline_access �@�@Maintain access to data you have given it access to ��I���B ���� POP�@�ŃG���^�[�L�[�A �@�@POP.AccessAsUser.All �@�@Read and write access to mailboxes via POP. ��I���B ����SMTP ����͂��� �@�@SMTP.Send �@�@Send emails from mailboxes using SMTP AUTH. ��I�����܂��B
�c�[��(office365-oauth2.vbs �t�@�C��)�̃_�E�����[�h�́A ������B
�g�p����scope �́A�ȉ��̒ʂ�ł��B
POP ..... https://outlook.office.com/POP.AccessAsUser.All
SMTP .... https://outlook.office.com/SMTP.Send
1. �c�[���ŔF�R�[�h���擾
office365-oauth2.vbs �t�@�C�����G�f�B�^�ŊJ���āA���������ߍ��݂܂��B
office365-oauth2.vbs�@�t�@�C���̓��e�B ''============================================== '' ���O�t�@�C���Z�b�g LOGFILE="C:\����slog.txt" '' curl �g���[�X�t�@�C���Z�b�g CURLTRACE1="--trace-ascii C:\����clog1.txt" CURLTRACE2="--trace-ascii C:\����clog2.txt" '�N���C�A���gID���Z�b�g CID="����" '�N���C�A���g�V�[�N���b�g���Z�b�g CSS="����" '�e�i���gID���Z�b�g TID="����" '==============================================office365-oauth2.vbs �t�@�C�����_�u���N���b�N���Ď��s���܂��B
2.�F�R�[�h�擾
�u���E�U�������N�����܂��̂ŔF�R�[�h���擾���܂��B
�u���E�U��URL��@���Ɠ��Ӊ�ʂ��\������܂��B
�g�p����A�J�E���g��I���B
���̂Ƃ��ABASP21 Pro �Ŏg�����[���A�h���X�ŔF���Ă��������B
�c�[���ōēx�A�F�R�[�h�擾�����蒼���ꍇ�́A �ȉ��̂悤��2�̕ϐ����N���A���Ă��������B
office365-oauth2.vbs�@�t�@�C���̓��e�B '' �ϐ��N���A ACC="" REF=""
[����]���N���b�N�B
�u���E�U��URL�����ŕ\�������F�R�[�h���R�s�[���āA
office365-oauth2.vbs �t�@�C�����ɃZ�b�g���܂��B
?code=xxxxxxxxxxxxxxxxxxxxxxxx
xxxxxx�̕����ł��B
office365-oauth2.vbs�@�t�@�C���̓��e�B ' �t�F�[�Y