ServerObjects ASPMail Return-Path Not Working?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ewen
    New Member
    • Mar 2008
    • 1

    ServerObjects ASPMail Return-Path Not Working?

    Hi,

    I've searched the forums but can't find a specific answer to this particular problem.

    We're using ServerObjects ASPMail (SMTPSVG.DLL) to send system generated emails on behalf of users of our sites. As such, we need to set 'correct' Return-Path: and Sender: headers in those emails.

    I'm using Mailer.AddExtra Header to do this, in the following code:

    [code=asp] Set Mailer = Server.CreateOb ject("SMTPsvg.M ailer")
    Mailer.RemoteHo st = cEmailRemoteHos t '-- Constant
    Mailer.FromName = cEmailFromName '-- Constant
    Mailer.FromAddr ess = FromEmail '-- Email address of user
    Mailer.AddRecip ient EmailToName, EmailToAddress
    Mailer.AddBCC cBCCName, cBCCAddress '-- Constant
    Mailer.Subject = cEmailSubject '-- Constant
    Mailer.BodyText = MessageToSend

    '-- Following lines added to incorporate SPF best practice
    Mailer.AddExtra Header "Return-Path: noreply@ourdoma in.com"
    Mailer.AddExtra Header "Sender: noreply@ourdoma in.com"

    'send the email
    if Mailer.SendMail then
    MailSent = 1
    'response.write ("<BR>Debug - Mail sent.")
    else
    MailSent = 0
    response.write( "<BR>Debug - Mail not sent. " & Mailer.response & "<BR>")
    end if
    set Mailer = nothing [/code]
    The problem is that while the Sender: header is getting set correctly, the Return-Path: header isn't. It's getting set as the email address of the user we're sending the email on behalf of, which obviously isn't what we want.

    Can anyone spot what's wrong, or indeed, does anyone know of a bug with ASPMail whereby the Return-Path: header doesn't get correctly set?

    We're using Windows Server 2003, IIS 6.0, and 'classic' (ie not .NET) ASP.

    Thanks in advance,
    Ewen
    Last edited by jhardman; Mar 17 '08, 03:00 PM. Reason: put code in code tags. Please use code tags in the future, notice button marked - # -
Working...