Cannot find an overload for "Add" and the argument count: "1"
<p>I got two different scripts and combined them to check a specific folder for new file and email that file as attachment.</p>

<p>Here's the code combined:</p>

<pre><code>Param (
    $Path = "C:\path"
    )

$File = Get-ChildItem $Path | Where { $_.LastWriteTime -ge [datetime]::Now.AddMinutes(-10) }
If ($File)
{   
$emailSmtpServer = "smtp.xxxx.com"
$emailSmtpServerPort = "587"
$emailSmtpUser = "xxxx@xxxxxx.com"
$emailSmtpPass = "xxxxxxxx"

$emailMessage = New-Object System.Net.Mail.MailMessage
$emailMessage.From = "Xxxx Xxxx &lt;xxxx@xxxxxx.com&gt;"
$emailMessage.To.Add( "xxxx@xxxxxx.com" )
$emailMessage.Subject = "File Test Report"
$emailMessage.IsBodyHtml = $false
$emailMessage.Body = "Weekly Report"

$SMTPClient = New-Object System.Net.Mail.SmtpClient( $emailSmtpServer , $emailSmtpServerPort )
$SMTPClient.EnableSsl = $true
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential( $emailSmtpUser , $emailSmtpPass );
$attachment = $File
$emailMessage.Attachments.Add($attachment)

$SMTPClient.Send($emailMessage) 
}
</code></pre>

<p>The code works fine, it looks for new file and sends the email except it won't attach the file and I get the following error</p>

<pre><code>Cannot find an overload for "Add" and the argument count: "1".
At D:\SendEmail2.ps1:24 char:1
+ $emailMessage.Attachments.Add($attachment)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodCountCouldNotFindBest
</code></pre>

<p>I think it has something to do with calling the file with <code>$attachment = $File</code></p>

<p>Can anyone help?</p>