Find a topic

How do I use Gmail smtp?

You are not authorized to post a reply.
Sort:
Declan Ward
New Member
New Member
Posts:8
Association Member
    This PowerShell script sends email from a VPS to the targeted email account via Gmail:

    $From = "web@mydomain.com"
    $username = "web@mydomain.com"
    $pwd = "AReallyStrongPassword"
    $To = "me@myotherdomain.com"
    $Server = "smtp.gmail.com"
    $port = 587
    $Subj = "Test"
    $Bod = "Test from Gmail"
    $securepwd = ConvertTo-SecureString $pwd -AsPlainText -Force
    $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $username, $securepwd
    Send-MailMessage -To $To -From $From -Body $Bod -Subject $Subj -SmtpServer $Server -port $port -UseSsl -Credential $cred

    In DNN, I set the SMTP settings (host) to use smtp.gmail.com:587 and enter the username and password. Clicking Test responds to say email is sent but it never arrives. Nothing appears in the event log.

    If the PowerShell script works, why does DNN fail? Any thoughts on how I can debug this?





    Mariëtte Knap
    New Member
    New Member
    Posts:17
    Association Member
      Hi Declan, did you add the smtp.gmail.com to your SPF records for your domain?
      Declan Ward
      New Member
      New Member
      Posts:8
      Association Member
        Hi Mariette,

        I have v=spf1 include:_spf.google.com ~all as per instructions found here: https://support.google.com/a/answer...8723?hl=en

        However, the Powershell Script worked from the same server so why not DNN?
        You are not authorized to post a reply.

        Hosting liberally provided by