.net SMTP – Sending An Email Message With A Display Name

email-blueIf you’ve ever used .net to send email messages (and I hope you have!) you may have wanted to send the message from or to not only an address, but also include a name. The ‘display name’ is the name that appears in many email clients instead of the address (think ‘Chris Bitting’ instead of ‘cbitting@something.com’). .Net honors the email standard of “Display Name <email@domain.com>”.

Below is a quick example on how this looks in vb.net:

Dim mail As New System.Net.Mail.MailMessage("""Some Body"" <person@company.com>", """A Different Person"" <person2@company2.com>", "Subject", "Body")

Below is a full example on an email function (include Imports System.Net.Mail): Continue reading “.net SMTP – Sending An Email Message With A Display Name”

.net SMTP – Sending An Email Message With A Display Name

IIS / WordPress – Blocking User Agents using Rewrite Rules

wp_logo

If you run WordPress on Windows (and who doesn’t?) and have the need to block specific user agents (bots, crawlers, browsers) below is a decent way I’ve found that uses rewriting rules and works along side the needed WordPress rules:

Adding this rule to your web.config will block the request from the specified agent(s):

 <rule name="RequestBlockingRule1" stopProcessing="true">
          <match url=".*" />
          <conditions>
            <add input="{HTTP_USER_AGENT}" pattern="agent1|agent2|agent3" />
          </conditions>
          <action type="CustomResponse" statusCode="403"
             statusReason="Forbidden: Access is denied."
             statusDescription="You do not have permission to view this page." />
        </rule>

Continue reading “IIS / WordPress – Blocking User Agents using Rewrite Rules”

IIS / WordPress – Blocking User Agents using Rewrite Rules