0

I am trying to send the emails from my XPage, to external email ID (my personal email ID), but getting error while executing the code.

I am running the XPage application on my local domino server. I haven't changed any configuration settings to enable emails/smtp as I am not aware of how to make these changes. This is the local server, and in my XPage application, my requirement is to send emails to personal email id rather than lotus notes mail box. I the server, I haven't configured mail databases for any user.

I tried following ways to send the mail, but nothing worked:

//Approach 1, simply mention from and to as external email addresses
var docMail : NotesDocument = database.createDocument();
docMail.replaceItemValue("Form","memo";
docMail.replaceItemValue("From","abc@gmail.com";//assume this is actual mail id
docMail.replaceItemValue("SendTo","def@gmail.com";//assume this is actual mail id
docMail.replaceItemValue("Subject","Test mail";//assume this is actual mail id
docMail.send();



//Approach 2, suppose I am logged in as test user1/Dev
//Configured forwarding address for test user1 and test user2 as abc@gmail.com and def@gmail.com respectively.

var docMail : NotesDocument = database.createDocument();
docMail.replaceItemValue("Form","memo";
docMail.replaceItemValue("SendTo","CN=Test User2/O=Dev";//assume this is actual mail id
docMail.replaceItemValue("Subject","Test mail";//assume this is actual mail id
docMail.send();

Here, docMail.send() is throwing some SMTP error, saying something like destination mail system is unreachable.

After following the instructions given in tech-notes (see the link in below comments), now docMail.send() is throwing error, and the console shows the error message: 'Development/Home is not a known TCP/IP host' (assume Development/Home is my local development server).

2 Answers2

3

If it is saying that the destination mail system is unreachable, that means that your server is unable to open an SMTP connection to gmail.com. Something on your network is blocking it. That might be a local security restriction on the machine where your server is running, or it could be somewhere on your network. In either case, this is a routine countermeasure intended to prevent computers inside your organization from sending out undetected spam messages if they have been taken over by malware.

You're probably going to need to configure your server to use an outbound relay server. Here's an IBM technote that discusses configuring a relay on Domino 8.5. The details may differ for other versions. The help database for the Domino Administration client will contain appropriate details for your version. If you encounter problems setting it up, ServerFault is the appropriate forum for follow-up, not here on StackOverflow.

Richard Schwartz
  • 14,463
  • 2
  • 23
  • 41
  • Thanks Richard, I will try the suggested steps. – Romil Handoo Dec 26 '18 at 07:02
  • I have tried the steps given in 'IBM technote', and tried sending the mails. Now, in my XPage, I am getting the error at line 'docMail.send()'. I checked the server concole, and found the error message 'Development/Home is not a known TCP/IP host' (Assume Development/Home is my local server name). I am sure this is because I am missing something while making necessary changes as per 'IBM Technotes'. Please suggest. – Romil Handoo Dec 27 '18 at 04:25
  • This is caused by your server attempting to open a TCP/IP connection to itself but failing to find it's own IP address. You can confirm this by trying a "ping development" command in a shell or cmd.exe window. – Richard Schwartz Dec 27 '18 at 14:21
  • The server uses the following sources to locate an IP address: Connection documents in names.nsf, the Ports table in server documents in the names.nsf, and the TCP/IP resolver (which uses DNS and/or a local hosts file - HOSTS.TXT on Windows). The easiest thing for you to do in a dev environment is usually to edit the Server document and put the correct IP address in the Network Address column for the TCPIP port. In production, it's better to make sure the DNS entry exists. – Richard Schwartz Dec 27 '18 at 14:24
  • Ok Richard, I will make the suggested setting changes – Romil Handoo Dec 28 '18 at 06:04
0

According to the documentation https://www.ibm.com/support/knowledgecenter/en/SSVRGU_9.0.1/basic/H_ABOUT_FIELDS_THAT_CONTROL_MAILING_OPTIONS.html You should set the Field "sendTo" instead of "To"

umeli
  • 1,068
  • 8
  • 14
  • Thanks Umeli for the observation. In my program, I am setting 'SendTo' field, and here I typed the field name incorrectly. Even after having the field name as 'SendTo', the program still shows same error. – Romil Handoo Dec 28 '18 at 04:08