SMTP - Change sender for specific forwarded emails (826 Views)
Reply
vms
Occasional Collector
vms
Posts: 5
Registered: ‎10-06-2010
Message 1 of 12 (826 Views)
Accepted Solution

SMTP - Change sender for specific forwarded emails

I'm forwarding emails (MAIL>set forward /user=localuser CENTER::USER) from production VMS servers to the only VMS server which has SMTP enabled (CENTER) . From here, it is forwarded to Lotus email (MAIL>set forward/user=USER SMTP%myuser@mydomain.com" ). 

The forwarded emails have the decnet format in sender field "SERVER::localuser"@vmsdomain.com

 

The problem is that, after an upgrade, Lotus server is rejecting all emails from senders containing ":" character.  The admin from Lotus support advised that we change sender address, because character ":" (colon) is agains RFC rules. I found in RFC 2822 that the colon is indeed to be avoided, but only for field names, not for field bodies; I guess Lotus admin interpreted differently.

 

When I send email from command line (MAIL NL: /subject="test" smtp%"myuser@mydomain.com" ) from CENTER server, the sender address does not contain the 2 colons "::" and email is received correctly. Sender shows like "USER@vmsdomain.com"

 

I tested with logical name TCPIP$SMTP_FROM defined /system /exec on the SMTP VMS server and it works, but I cannot use it because it's affecting also customer emails. I only need this sender address changed for the specific account which is sending reports from all servers; also the is only one destination address for this purpose. 

 

For the record, I'm runing OpenVMS 7.3.-2,  TCPIP V5.4 - ECO 7

 

Please use plain text.
Trusted Contributor
abrsvc
Posts: 360
Registered: ‎06-08-2010
Message 2 of 12 (822 Views)

Re: SMTP - Change sender for specific forwarded emails

I have no way to test this, but perhaps setting the logical name within the GROUP table will work for this account?

Dan
Please use plain text.
vms
Occasional Collector
vms
Posts: 5
Registered: ‎10-06-2010
Message 3 of 12 (818 Views)

Re: SMTP - Change sender for specific forwarded emails

[ Edited ]

Unfortunately all forwarded emails are sent from CENTER node using account SMTP$SERVER , and not the specific account. Would be good if there was a way to change this behaviour.

 

It will not help to define this logical on each server which is sending reports (where mails are sent using utility MAIL from the specific account used for reports), I already tested.

 

Catalin

Please use plain text.
Honored Contributor
Volker Halle
Posts: 5,190
Registered: ‎04-26-2004
Message 4 of 12 (810 Views)

Re: SMTP - Change sender for specific forwarded emails

Catalin,

 

there is an OpenVMS Freeware utility called 'DELIVER'. It may be possible to use this to individually process each mail separately.

 

For more information, look at:

 

http://www3.sympatico.ca/n.rieck/docs/openvms_notes_deliver.html

 

Volker.

Please use plain text.
Honored Contributor
Hoff
Posts: 4,910
Registered: ‎01-29-2006
Message 5 of 12 (794 Views)

Re: SMTP - Change sender for specific forwarded emails

So your production server has (only) a DECnet connection to the remote SMTP server?

 

Or does your production server (also) have IP, but no local SMTP server?

 

If it's the latter case, run some php or analogous code that uses a remote mail server directly, and that bypasses the limited SMTP server that's part of TCP/IP Services.  I'd tend to expect that the PHPmailer script would work here, and there are SMTP-capable libraries available for most any modern scripting language.

 

If you're inclined, there's also a DCL procedure around that connects DECnet to submit VAX mail remotely, if you're willing to tweak some port access protections.  That's a couple-dozen lines of DCL.

 

If you have a support contract, then upgrade to the current TCP/IP Services patch for V5.4, and (if the colons persist) ask HP about the colons in the forwarding.

 

Please use plain text.
Honored Contributor
John Gillings
Posts: 2,992
Registered: ‎07-31-2003
Message 6 of 12 (787 Views)

Re: SMTP - Change sender for specific forwarded emails

[ Edited ]

Catalin,

 

   Your SMTP$SERVER account has a LOGIN.COM, which is probably empty at the moment. If you can identify the incoming email request you want to change, you can define TCPIP$SMTP_FROM.

 

Without doing anything clever, you can immediately identify the source node of the request as logical name SYS$REM_NODE. So, if all mail from SERVER1 needs a modified from address, all you need to is test SYS$REM_NODE, and if it matches, define TCPIP$SMTP_FROM to whatever you want. If you need to be more selective there are other network structures you can look into (but I'm not sure if you can do it in a non-descructive manner).

 

Simple way to start investigating, add this line to LOGIN.COM:

 

$ @SHOWALL/OUTPUT=LOGIN.LOG

 

and in SHOWALL.COM:

 

$ SHOW LOGICAL

$ SHOW SYMBOL *

 

Now start sending different mails and compare the outputs in the log files.

 

I also wonder what happens if you change your initial forward to:

 

MAIL>set forward /user=localuser SMTP%"USER@CENTER.mydomain.com"

 

 

 

Another trick we use... if the set of target addresses is fairly small is to create tcpip alias addresses which point to your gateway node. For example, suppose your corporate addresses are "someone@mycorp.com" and you also want to be able to send messages to "someone@anothercorp.com", "someone@pager.service.com" and "someone@gmail.com".  Your node with an SMTP server, and access to the outside world is CENTER.MYCORP.COM at IP address 10.1.1.10. On SERVER1.MYCORP.COM and SERVER2.MYCORP.COM, start the SMTP service. All you need to define is the general gateway, which points to 10.1.1.10. The trick is to define each target domain as an alias of the gateway address in the local host file. Thus:

 

$ TCPIP SET HOST CENTER/ADDRESS=10.1.1.10/ALIAS=(mycorp.com,anothercorp.com,pager.service.com,gmail.com)

 

Since the nodes are isolated from the rest of the world anyway, it doesn't matter that these addresses translate to the wrong address. The only one which might cause trouble is "mycorp.com" if the node is a member of that domain.

Now, from SERVER1 and SERVER2 you can send "directly" to addresses in those domains. What's more, defining TCPIP$SMTP_FROM works as you expect from the sender process on SERVER1. The mechanism is the SMTP server on SERVER1 translates (say) gmail.com into 10.1.1.10, so it delivers the mail to that node, but the "to" address is still in text form. When CENTER receives the message, it translates gmail.com into the proper address and forwards it.

 

(Note that the limitation of having to define all the potential target domains can be turned into a virtue wrt auditors. You can say that processes on SERVER1 and SERVER2 can ONLY send mail to your specified set of authorised addresses ;-)

A crucible of informative mistakes
Please use plain text.
vms
Occasional Collector
vms
Posts: 5
Registered: ‎10-06-2010
Message 7 of 12 (757 Views)

Re: SMTP - Change sender for specific forwarded emails

[ Edited ]

@All  Thanks to all for your replies.

@Volker, Hoff  I wanted a more simple solution, before starting to search new software or make major changes, but thanks anyway.

    The solution I was thinking to was to use decnet copy from production nodes to central node instead of mail, then run a batch job on central node to search for new reports and send them by email.  But John's solution is more simple.

 

 

@John, In fact it is user MAIL$SERVER  and not smtp$server as I wrote in previous post, but worked as you said, with conditional defining of TCPIP$SMTP_FROM inside the login.com

I used SYS$REM_ID instead of node, because there are just too many nodes.

Thanks a lot

 

Catalin

Please use plain text.
Honored Contributor
Hoff
Posts: 4,910
Registered: ‎01-29-2006
Message 8 of 12 (751 Views)

Re: SMTP - Change sender for specific forwarded emails

FWIW...

 

If you're still running DECnet and thinking "COPY" and "BATCH" for remote operations, then something such as DECnet task-to-task in DCL, or remote queue operations via the DQS product, can be a good fit.

 

And here is the DCL-sending DECnet MAIL-11 MAIL code.

 

Please use plain text.
vms
Occasional Collector
vms
Posts: 5
Registered: ‎10-06-2010
Message 9 of 12 (727 Views)

Re: SMTP - Change sender for specific forwarded emails

After losing some new emails, and after more analysis and watching the log file SYS$SPECIFIC:[MAIL$SERVER]NET$SERVER.LOG , I noticed that SYS$SPECIFIC:[MAIL$SERVER]login.com is executed only some times and that this is because MAIL_SERVER object is spawnining a process Server_xxx which is used by more decnet mails, in a similar way that the FAL$SERVER is reusing one process for more decnet copy transfers.  If there is no decnet mail traffic, the process Server_xxx dies and another one is spawned when next decnet mail is coming; so all emails sharing the same decnet process are sharing also the same logical name TCPIP$SMTP_FROM. This is not good. 

I'm searching now a way to make the process die immediately so there will be only one process per mail.

Please use plain text.
Honored Contributor
Hoff
Posts: 4,910
Registered: ‎01-29-2006
Message 10 of 12 (724 Views)

Re: SMTP - Change sender for specific forwarded emails

[ Edited ]

I'm getting the distinct impression you want a solution that you can picture and understand and support (entirely reasonable), but where youre headed right now is not (in this case) probably going to be the simple solution.

 

You're aiming at a set of solutions that requires system-wide effects including defeating cached processes, proper timeout management in an environment than can potentially (or actuall) invoke asynchronous arriving traffic, and setting up the return address within a shared context.  That's sounding not-simple.  What happens if you (still) receive two messages within your far shorter server process timeout?

 

Pipe your data over to the server with SMTP using some client DCL to server DCL, and MAIL it from there.  

 

(There are other and more ways to communicate with a remote SMTP server, but I'm guessing you're not familiar with Perl, php or Python, and not looking to move to a compiled-in client, nor migrate to Process Software's SMTP client transport.  DCL, particularly, lacks all IP capabilities.)

 

Run some experiments with the client-server DCL.  That doesn't involve digging around underneath mail, nor managing process deletion in an asynchronous environment, and you have full control over the dedicated DCL-based server process running on the SMTP server host; the code that's sending the outbound mail.

Please use plain text.
vms
Occasional Collector
vms
Posts: 5
Registered: ‎10-06-2010
Message 11 of 12 (707 Views)

Re: SMTP - Change sender for specific forwarded emails

Putting define netserver$timeout 0 only inside SYS$SPECIFIC:[MAIL$SERVER]login.com solved that last issue. 

I think this is also limiting the possible system-wide side effects on other decnet activities.

 

@Hoff, Thanks for your input

I brute-tested sending batched decnet mails simultanously from different servers and noticed no problem; I see in accounting the MAIL$SERVER decnet processes are even overlapping. 

Also tested your dcl mail (http://labs.hoffmanlabs.com/node/725), quite interesting is that mail object can be open/read/write in the same time by 2 processes. 

 

Please use plain text.
Honored Contributor
Hoff
Posts: 4,910
Registered: ‎01-29-2006
Message 12 of 12 (700 Views)

Re: SMTP - Change sender for specific forwarded emails

>quite interesting is that mail object can be open/read/write in the same time by 2 processes. 

 

You're on a network.  Stuff happens asynchronously.  And with the massive increases in mobile web activity, the network connections can randomly drop as the client crosses cell coverage dead spots, meaning the servers have to contend with gltiches most anywhere in the traffic.

 

Writing AST-based event-driven servers on VMS is fairly easy, and most servers on VMS are either AST-based or they'll use something akin to inetd or its DECnet analog to start up server processes for incoming connections.  Apache uses a pool of server processes for its traffic.  

 

(This is AST-based processing I'm referring to with the VMS server processes.  Threaded code with pthreads has rather more "gnarly" than does AST-based code, in my experience.  Fewer VMS server processes use threads.)

Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation