如何使用PHP在lotus notes中发送电子邮件?

时间:2022-10-08 18:14:43

Need to send email using PHP via lotus notes. Notes is configured on my system. So just wanted if I could send email using PHP. Can anybody help with the code and configuration that I am supposed to do?

需要通过lotus notes使用PHP发送电子邮件。Notes是在我的系统上配置的。如果我可以用PHP发送电子邮件。有没有人能帮我处理我应该做的代码和配置?


After reading replies from all of you, I tried to nail down things from my end. I could at least move one step ahead with all your help. I could figure out my mail server using GetEnvironmentString and its damn correct as also reflected in my lotus notes work space. But when I am trying to use the below code it just keeps on loading and finally returning nothing -

阅读完所有的回复后,我试着把事情从我的结局中剔除。我至少可以在你的帮助下迈出一步。我可以用GetEnvironmentString找到我的邮件服务器,它的正确也反映在我的lotus notes工作空间中。但是,当我尝试使用下面的代码时,它只是继续加载,最后什么也没有返回。

<?php

       require_once "Mail.php";

        $from = "abc@email.com";
        $to = "abc@email.com";
        $subject = "Test!";
        $body = "Hi,\n\nTest?";

        $host = "d23abcd";
        $port = "1352";
        $username = "abc@email.com";
        $password = "mypassword";

        $headers = array ('From' => $from,
          'To' => $to,
          'Subject' => $subject);
        $smtp = Mail::factory('smtp',
          array ('host' => $host,
            'port' => $port,
            'auth' => true,
            'username' => $username,
            'password' => $password));

        $mail = $smtp->send($to, $headers, $body);

        if (PEAR::isError($mail)) {
          echo("<p>" . $mail->getMessage() . "</p>");
         } else {
          echo("<p>Message successfully sent!</p>");
         }

    ?> 

Am I committing some mistake here? I doubt

我犯了什么错误吗?我怀疑

 $host = "d23abcd";
 $port = "1352";

3 个解决方案

#1


3  

If your Lotus Domino server has SMTP set up, you can use the Domino server as outgoing mail server (if PHP is able to send mail using a relay server).

如果Lotus Domino服务器设置了SMTP,那么可以使用Domino服务器作为发送邮件服务器(如果PHP能够使用中继服务器发送邮件)。

#2


1  

Thanks a bunch for all your responses and replies. Finally, I am able to send mail using domino server. Would like to share few things that I came across -

多谢你的回复和回复。最后,我可以使用domino服务器发送邮件。我想分享我遇到的几件事- ?

  1. Using $session->GetEnvironmentString("MailServer",True); figured out the server where session is an instance of COM object for Notes.NotesSession like new COM( "Notes.NotesSession" );

    使用$ session - > GetEnvironmentString(“服务器”,真正的);计算出会话为Notes的COM对象实例的服务器。不像新的COM(Notes)。NotesSession”);

  2. Secondly, I was trying with port 1352 which I got from netstat command for this particluar server process. But it didnt work and finally worked on 25 only.

    其次,我正在尝试从netstat命令中获得的端口1352,这是这个particluar服务器进程。但它并没有奏效,最终只在25号工作。

  3. Domino server was not accepting authentication, so used mail($to,$subject,$message,$headers); instead of $mail = $smtp->send($to, $headers, $body);

    Domino服务器不接受身份验证,所以使用邮件($to、$subject、$message、$header);而不是$mail = $smtp->send($to, $header, $body);

Happy that it worked. Thanks all for the help and suggestions.

快乐工作。谢谢大家的帮助和建议。

#3


0  

Using your local Notes Client or a Notes Client installed on a "server" via COM to send mail is not a good idea. What you want is to send email from PHP via an SMTP server (which can be a Domino server, as Per pointed out).

使用本地Notes客户机或在“服务器”上安装的Notes客户机发送邮件不是一个好主意。您想要的是通过SMTP服务器从PHP发送电子邮件(正如所指出的那样,它可以是一个Domino服务器)。

Sending email via PHP is for example explained here and here. For the name of the server, the port used for SMTP and optional credentials, please contact your local Domino admin.

例如,通过PHP发送电子邮件就可以在这里和这里解释。对于服务器的名称、用于SMTP的端口和可选的凭证,请联系您的本地Domino admin。

#1


3  

If your Lotus Domino server has SMTP set up, you can use the Domino server as outgoing mail server (if PHP is able to send mail using a relay server).

如果Lotus Domino服务器设置了SMTP,那么可以使用Domino服务器作为发送邮件服务器(如果PHP能够使用中继服务器发送邮件)。

#2


1  

Thanks a bunch for all your responses and replies. Finally, I am able to send mail using domino server. Would like to share few things that I came across -

多谢你的回复和回复。最后,我可以使用domino服务器发送邮件。我想分享我遇到的几件事- ?

  1. Using $session->GetEnvironmentString("MailServer",True); figured out the server where session is an instance of COM object for Notes.NotesSession like new COM( "Notes.NotesSession" );

    使用$ session - > GetEnvironmentString(“服务器”,真正的);计算出会话为Notes的COM对象实例的服务器。不像新的COM(Notes)。NotesSession”);

  2. Secondly, I was trying with port 1352 which I got from netstat command for this particluar server process. But it didnt work and finally worked on 25 only.

    其次,我正在尝试从netstat命令中获得的端口1352,这是这个particluar服务器进程。但它并没有奏效,最终只在25号工作。

  3. Domino server was not accepting authentication, so used mail($to,$subject,$message,$headers); instead of $mail = $smtp->send($to, $headers, $body);

    Domino服务器不接受身份验证,所以使用邮件($to、$subject、$message、$header);而不是$mail = $smtp->send($to, $header, $body);

Happy that it worked. Thanks all for the help and suggestions.

快乐工作。谢谢大家的帮助和建议。

#3


0  

Using your local Notes Client or a Notes Client installed on a "server" via COM to send mail is not a good idea. What you want is to send email from PHP via an SMTP server (which can be a Domino server, as Per pointed out).

使用本地Notes客户机或在“服务器”上安装的Notes客户机发送邮件不是一个好主意。您想要的是通过SMTP服务器从PHP发送电子邮件(正如所指出的那样,它可以是一个Domino服务器)。

Sending email via PHP is for example explained here and here. For the name of the server, the port used for SMTP and optional credentials, please contact your local Domino admin.

例如,通过PHP发送电子邮件就可以在这里和这里解释。对于服务器的名称、用于SMTP的端口和可选的凭证,请联系您的本地Domino admin。