3 ms·
You probably don't want to be hard-coding the address of your SMTP forwarding host in a script. If you have to change to a different one, you will have to hunt
by kazinator 11y ago
You probably don't want to be hard-coding the address of your SMTP forwarding host in a script. If you have to change to a different one, you will have to hunt down this sort of usage and fix it.
- stephengillie 11y agoYes, but if it weren't hard-coded, it wouldn't count as being a one-liner. ;) Besides, it's rare for DNS names to change; the point of DNS is the underlying server addresses can change without changing the name. And a service like SMTP relay should be less likely to change than other types of host. But still, good point. This could easily be a Param if the function would be used in many environments.
- kazinator 11y agoOh the DNS name will change if you use your ISP-provided SMTP server and you change your ISP from Acme Internet Services to A-1 Networks. :)
- stephengillie 11y agoAh, that's exactly the kind of situation where you'd want a param with a default. As an example: PS C:\> New-Parameter SMTPSvr -TopHeader -BottomHeader -ParameterType string -DefaultValue "mail.example.com" Param( [string]$SMTPSvr = "mail.example.com" ) #end Param