Code Monkey home page Code Monkey logo

Comments (16)

reinaldocoelho avatar reinaldocoelho commented on July 16, 2024 1

Hi @logikonline.
You sent this message using SMTP of Gmail?
If so, unfortunelly we can´t do any thing to avoid that.
If not, the gmail can't receive that information, and I don´t know how google know that.

I´m close this issue, if you need something more, please, reply on that :-)
Thank you.

from mailsystem.net.

logikonline avatar logikonline commented on July 16, 2024

This should NOT be closed. I am sending a message object I saved in the app and it is showing the addresses in the BCC. I feel this is because the message is not formatted correctly.

from mailsystem.net.

logikonline avatar logikonline commented on July 16, 2024

Here is a sample message----

Delivered-To:
Received: by 10.28.58.70 with SMTP id h67csp2347446wma;
Wed, 29 Nov 2017 04:23:33 -0800 (PST)
X-Google-Smtp-Source: AGs4zMZIXGt3U20RKi0dTMQQ3Z+JiKD0/yRyT1G+NR82XW6b9TqAoCfLpHQhBgAU8EEXWztmOE0f
X-Received: by 10.55.105.131 with SMTP id e125mr3829024qkc.214.1511958213673;
Wed, 29 Nov 2017 04:23:33 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1511958213; cv=none;
d=google.com; s=arc-20160816;
b=VlZOCMHf6pGuGKL5G6NfJeIygZB3eyQaqU8GDZOSatpOczxpRu6yL6l2kdYVLh5mJA
pD3FnjUVBhFxtW2pIdmbZBI1UDDRhuSk7kYH/veUv9lDpfdmIf/sK9mUfSOTmbOIofIx
VUPTq4+MAU7GlXWQB7N6z7D96OfDp7sMjD0iJA1RrBi8q9JXRnDcj2aTzBNuR/ZKdvS+
HmWPIFSuOEOkBnX9LCtjQ2UE7vdEzB21W42chqiMdTnqaawA6daDY6FJ/8x4xETA2fxt
fq4UUxrXmU0ShmRC4W7701HyCKHTxr8lgT4LiQCM8eddg2Q9GyKrQORpGLmYisAQpM3U
O7yA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
h=message-id:from:date:subject:importance:dkim-signature
:arc-authentication-results;
bh=d+Kz+stixaqujbjXHZ5LYgVuqOkFyrAWddI0Cx9mQZo=;
b=SD3RvN4ju0BOh0mTmjdUfmRZCh4Y2eLwY7O259D9nZtjeTX4qhLENDmgZsxjSKMSZW
0MBGATagKmDqD5f1MD0yNUmDd+x3ghVYusuvfrU3hfbYowQ2mesV8izGFi4nqg0izX+y
Mgbf57Y3WAIdZ9lt9ULQ2gDwVYFl9oPi6HfdkeVM5P7MnbLxZJjiV7mTn1KpTAb/0M9F
gSqSsPfxmK6ooaom54ZDUYaieJh8v7S9Mq6eMAV61YmVtxZpfoz69tneISislHrgap5Y
Q+swZRZSCt8QsSdmPCU3q1ZnSNXqLzpQvbFhppykP1+22R2SvUvgG5q1HFeGKk4+0F3/
3kdA==
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass [email protected] header.s=smtpapi header.b=NPtHOGc8;
spf=pass (google.com: domain of bounces+1111450-570d-dave=[email protected] designates 168.245.5.182 as permitted sender) smtp.mailfrom=bounces+1111450-570d-dave=[email protected]
Return-Path: [email protected]
Received: from o1682455182.outbound-mail.sendgrid.net (o1682455182.outbound-mail.sendgrid.net. [168.245.5.182])
by mx.google.com with ESMTPS id f10si169717qtj.176.2017.11.29.04.23.32
for [email protected]
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Wed, 29 Nov 2017 04:23:33 -0800 (PST)
Received-SPF: pass (google.com: domain of bounces+1111450-570d-dave=[email protected] designates 168.245.5.182 as permitted sender) client-ip=168.245.5.182;
Authentication-Results: mx.google.com;
dkim=pass [email protected] header.s=smtpapi header.b=NPtHOGc8;
spf=pass (google.com: domain of bounces+1111450-570d-dave=[email protected] designates 168.245.5.182 as permitted sender) smtp.mailfrom=bounces+1111450-570d-dave=[email protected]
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=sendgrid.me; h=subject:from:content-type; s=smtpapi; bh=bmChXX4Hj/z+EcfSsGWTNghuXrU=; b=NPtHOGc8f4mSf7oSrHXDMN9nSmgYM r0/LUMkAnzsOmH+sNsl+Xoi+tydVJtS/mibLslle3vHy4jW8O5+ZR3xq3qQwuzxe Qwb9kM+Z848YbmV4d8x1wZODRdc94LLuraCJHZT+FcofowAEjck19UvFr11xfV/4 kwVLDfQBhL/y8Y=
Received: by filter0015p3iad2.sendgrid.net with SMTP id filter0015p3iad2-24086-5A1EA6C2-3B
2017-11-29 12:23:32.026606549 +0000 UTC
Received: from RD00155D9ACC6C (unknown [137.117.81.52]) by ismtpd0007p1maa1.sendgrid.net (SG) with ESMTP id RMphQTm4S2KrqpcMlI_wbQ Wed, 29 Nov 2017 12:23:29.452 +0000 (UTC)
x-priority: Unknown
x-msmail-priority: Unknown
importance: Unknown
Subject: Canceled: Dash To The Finish Line
Date: Wed, 29 Nov 2017 12:23:32 +0000 (UTC)
From: MarketAlly Responder <....>
Bcc: Jorge Aquino <.....>, Dave Friedel <.....>

Message-ID: AU1046017112912232950555185655@RD00155D9ACC6C
Content-Type: multipart/related; boundary="---AU_MimePart_104601711291223264392338313"; type="multipart/alternative"
X-Mailer: ActiveUp.MailSystem 2.0.2 www.activeup.com
X-SG-EID: NC5l+ZyxP2iwbwVwcQYTM5FZo7AzBNDEjxBnPWqB2nAkxH+pxwja3jO2ARFD4bwlwqPp2cKY+eiNns q8cgJSMxXfETnny5q54knA6/3tfWuX8+6mF2ultWM6UjEphbuHTLuzyrwGEh0XkkbcAIuhNaIjJz38 dIWJ9JNU8qdxBwM/rM03Q1NaQ2KDH2yYmGXGF73291oz5pF5Vysf0x2C6hVQZ49zAmuEjpY12S0sgy 6098iJQCa2gbd+4OBKhR2X

-----AU_MimePart_104601711291223264392338313
Content-Type: multipart/alternative; boundary="---AU_MimePart_1046017112912232643921044820"
Content-Transfer-Encoding:

-----AU_MimePart_1046017112912232643921044820
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

MarketAlly

from mailsystem.net.

reinaldocoelho avatar reinaldocoelho commented on July 16, 2024

Hi @logikonline .

Can you send to me the example of code you use to create and send the message?

Thanks.

from mailsystem.net.

logikonline avatar logikonline commented on July 16, 2024

`<CLSCompliant(False)> Public Function GenericMessage(ByVal Addresses As MSGAddresses, ByVal messagePath As String, ByVal SMTPServer As SMTPServer, Optional ByVal HashReplace As KeyedList = Nothing, Optional ByVal HashListTemplates As KeyedList = Nothing, Optional ByVal Logo As String = "", Optional ByVal Attachments As MSGAttachment = Nothing, Optional ByRef aMessage As MailMessage = Nothing) As Boolean

        Dim retVal As Boolean = True
        Dim Var As String

        If IsNothing(messagePath) Then messagePath = ""

        If Addresses Is Nothing Or messagePath.Length = 0 Then
            Dim tEx As New Exception("Either Message or Address is blank.")
            _Access.RaiseError(tEx)
            Return False
        Else
            Try
                Dim tmpMain As ActiveUp.Net.Mail.Templater = New ActiveUp.Net.Mail.Templater(messagePath)

                For Each Address As MSGAddress In Addresses.Values
                    Select Case Address.Type
                        Case MessageType.To
                            tmpMain.Message.To.Add(Address)
                        Case MessageType.Bcc
                            tmpMain.Message.Bcc.Add(Address)
                        Case MessageType.Cc
                            tmpMain.Message.Cc.Add(Address)
                    End Select
                Next
                If Addresses.HasFrom Then
                    tmpMain.Message.From = Addresses.ReturnFrom
                End If
                tmpMain.Message.Date = Now.ToUniversalTime
                If SMTPServer.Host.Length > 0 Then
                    tmpMain.SmtpServers.Add(SMTPServer)
                End If
                'tmpMain.Message.
                Dim xmlNode As New System.Xml.XmlDocument
                xmlNode.Load(messagePath)
                Dim tNodes As System.Xml.XmlNodeList = xmlNode.SelectNodes("message/embeddedobject")
                If Not tNodes Is Nothing Then
                    For Each tNode As System.Xml.XmlElement In tNodes
                        Dim tFilename As String = tNode.GetAttribute("FILENAME")
                        Try
                            Select Case tNode.GetAttribute("TYPE").ToLower
                                Case "vcard"
                                    tmpMain.Message.Attachments.Add(tFilename, True)
                                Case "vcalendar"
                                    tmpMain.Message.Attachments.Add(tFilename, True)
                                Case "image"
                                    If Logo.Length > 0 And tNode.GetAttribute("NAME").ToUpper = "LOGO" Then
                                        'skip it
                                    ElseIf Not HashReplace Is Nothing AndAlso HashReplace.ContainsKey(tNode.GetAttribute("NAME")) AndAlso Access.ReturnString(HashReplace(tNode.GetAttribute("NAME"))).Length > 0 And tFilename.Length = 0 Then
                                        tmpMain.Message.EmbeddedObjects.Add(HashReplace(tNode.GetAttribute("NAME")), tNode.GetAttribute("NAME"))
                                    ElseIf tFilename.Length > 0 Then
                                        tmpMain.Message.EmbeddedObjects.Add(tFilename, tNode.GetAttribute("NAME"))
                                    End If
                                Case Else
                                    tmpMain.Message.Attachments.Add(tFilename, True)
                            End Select
                        Catch ex As Exception
                            _Access.RaiseError(ex)
                        End Try
                    Next
                End If
                Try
                    If Logo.Length > 0 Then
                        tmpMain.Message.EmbeddedObjects.Add(Logo, "LOGO")
                    End If
                Catch ex As Exception
                    _Access.RaiseError(ex)
                End Try

                If Not Attachments Is Nothing Then
                    For Each file As String In Attachments.Keys
                        Try
                            tmpMain.Message.Attachments.Add(file, False)
                        Catch ex As Exception
                            _Access.RaiseError(ex)
                        End Try
                    Next
                End If

                Dim merger As ActiveUp.Net.Mail.Merger = New ActiveUp.Net.Mail.Merger(tmpMain)
                If Not HashListTemplates Is Nothing Then
                    For Each Var In HashListTemplates.Keys
                        If Not Var Is Nothing Then
                            Try
                                merger.MergeListTemplate(Var.ToUpper, HashListTemplates(Var))
                            Catch ex As Exception
                                _Access.RaiseError(New Exception("Error merging list template: " & Var))
                                retVal = False
                            End Try
                        End If
                    Next
                End If
                If Not HashReplace Is Nothing Then
                    For Each Var In HashReplace.Keys
                        If Not Var Is Nothing AndAlso Not HashReplace(Var) Is Nothing Then
                            Try
                                merger.ReplaceField(tmpMain.Message, Var.ToUpper, Access.ReturnString(HashReplace(Var)))
                            Catch ex As Exception
                                _Access.RaiseError(New Exception("Error merging property: " & Var))
                            End Try
                        End If
                    Next
                End If

                merger.MergeMessage()
                If merger.Message.RecipientCount > 0 Then
                    aMessage = New MailMessage(merger.Message.Subject, merger.Message.BodyHtml.Text, merger.Message.From.Name, merger.Message.From.Email, merger.Message.Recipients(0).Email, merger.Message.Recipients(0).Name)
                    If SMTPServer.UseQueue Then
                        merger.Message.StoreToFile(SMTPServer.QueuePath & System.IO.Path.GetFileNameWithoutExtension(System.IO.Path.GetTempFileName) & ".eml")
                    Else
                        If tmpMain.SmtpServers.Count = 0 Then
                            ActiveUp.Net.Mail.SmtpClient.DirectSend(merger.Message)
                        Else
                            Try
                                If SMTPServer.Port = 587 Then
                                    Return ActiveUp.Net.Mail.SmtpClient.SendSsl(merger.Message, SMTPServer.Host, SMTPServer.Username, SMTPServer.Password, ActiveUp.Net.Mail.SaslMechanism.Login)
                                Else
                                    Return ActiveUp.Net.Mail.SmtpClient.Send(merger.Message, tmpMain.SmtpServers)
                                End If
                            Catch ex As Exception
                                ActiveUp.Net.Mail.SmtpClient.DirectSend(merger.Message)
                            End Try
                        End If
                    End If
                    Return True
                End If
            Catch ex As System.Exception
                _lastError = ex
                _Access.RaiseError(ex)
            End Try
        End If
        Return False

    End Function`

from mailsystem.net.

logikonline avatar logikonline commented on July 16, 2024

I made no changes to the core ActiveUp mail control - and build the message then send it via the "SendSsl" method. THe login details are the ones provided by SendGrid for a standard relay. If you need it ins C# I can provide too. I code in most languages fluently.

from mailsystem.net.

reinaldocoelho avatar reinaldocoelho commented on July 16, 2024

For me in C# is better :-)

from mailsystem.net.

logikonline avatar logikonline commented on July 16, 2024

[CLSCompliant(false)]
public bool GenericMessage(
MSGAddresses Addresses,
string messagePath,
SMTPServer SMTPServer,
KeyedList HashReplace,
KeyedList HashListTemplates,
string Logo,
MSGAttachment Attachments,
ref MailMessage aMessage) {
bool retVal = true;
string Var;
if ((messagePath == null)) {
messagePath = "";
}

    if (((Addresses == null) 
                || (messagePath.Length == 0))) {
        Exception tEx = new Exception("Either Message or Address is blank.");
        _Access.RaiseError(tEx);
        return false;
    }
    else {
        try {
            ActiveUp.Net.Mail.Templater tmpMain = new ActiveUp.Net.Mail.Templater(messagePath);
            foreach (MSGAddress Address in Addresses.Values) {
                switch (Address.Type) {
                    case MessageType.To:
                        tmpMain.Message.To.Add(Address);
                        break;
                    case MessageType.Bcc:
                        tmpMain.Message.Bcc.Add(Address);
                        break;
                    case MessageType.Cc:
                        tmpMain.Message.Cc.Add(Address);
                        break;
                }
            }
            
            if (Addresses.HasFrom) {
                tmpMain.Message.From = Addresses.ReturnFrom;
            }
            
            tmpMain.Message.Date = Now.ToUniversalTime;
            if ((SMTPServer.Host.Length > 0)) {
                tmpMain.SmtpServers.Add(SMTPServer);
            }
            
            // tmpMain.Message.
            System.Xml.XmlDocument xmlNode = new System.Xml.XmlDocument();
            xmlNode.Load(messagePath);
            System.Xml.XmlNodeList tNodes = xmlNode.SelectNodes("message/embeddedobject");
            if (!(tNodes == null)) {
                foreach (System.Xml.XmlElement tNode in tNodes) {
                    string tFilename = tNode.GetAttribute("FILENAME");
                    try {
                        switch (tNode.GetAttribute("TYPE").ToLower) {
                            case "vcard":
                                tmpMain.Message.Attachments.Add(tFilename, true);
                                break;
                            case "vcalendar":
                                tmpMain.Message.Attachments.Add(tFilename, true);
                                break;
                            case "image":
                                if (((Logo.Length > 0) 
                                            && (tNode.GetAttribute("NAME").ToUpper == "LOGO"))) {
                                    // skip it
                                }
                                else if ((!(HashReplace == null) 
                                            && (HashReplace.ContainsKey(tNode.GetAttribute("NAME")) 
                                            && ((Access.ReturnString(HashReplace(tNode.GetAttribute("NAME"))).Length > 0) 
                                            && (tFilename.Length == 0))))) {
                                    tmpMain.Message.EmbeddedObjects.Add(HashReplace(tNode.GetAttribute("NAME")), tNode.GetAttribute("NAME"));
                                }
                                else if ((tFilename.Length > 0)) {
                                    tmpMain.Message.EmbeddedObjects.Add(tFilename, tNode.GetAttribute("NAME"));
                                }
                                
                                break;
                            default:
                                tmpMain.Message.Attachments.Add(tFilename, true);
                                break;
                        }
                    }
                    catch (Exception ex) {
                        _Access.RaiseError(ex);
                    }
                    
                }
                
            }
            
            try {
                if ((Logo.Length > 0)) {
                    tmpMain.Message.EmbeddedObjects.Add(Logo, "LOGO");
                }
                
            }
            catch (Exception ex) {
                _Access.RaiseError(ex);
            }
            
            if (!(Attachments == null)) {
                foreach (string file in Attachments.Keys) {
                    try {
                        tmpMain.Message.Attachments.Add(file, false);
                    }
                    catch (Exception ex) {
                        _Access.RaiseError(ex);
                    }
                    
                }
                
            }
            
            ActiveUp.Net.Mail.Merger merger = new ActiveUp.Net.Mail.Merger(tmpMain);
            if (!(HashListTemplates == null)) {
                foreach (Var in HashListTemplates.Keys) {
                    if (!(Var == null)) {
                        try {
                            merger.MergeListTemplate(Var.ToUpper, HashListTemplates(Var));
                        }
                        catch (Exception ex) {
                            _Access.RaiseError(new Exception(("Error merging list template: " + Var)));
                            retVal = false;
                        }
                        
                    }
                    
                }
                
            }
            
            if (!(HashReplace == null)) {
                foreach (Var in HashReplace.Keys) {
                    if ((!(Var == null) 
                                && !(HashReplace(Var) == null))) {
                        try {
                            merger.ReplaceField(tmpMain.Message, Var.ToUpper, Access.ReturnString(HashReplace(Var)));
                        }
                        catch (Exception ex) {
                            _Access.RaiseError(new Exception(("Error merging property: " + Var)));
                        }
                        
                    }
                    
                }
                
            }
            
            merger.MergeMessage();
            if ((merger.Message.RecipientCount > 0)) {
                aMessage = new MailMessage(merger.Message.Subject, merger.Message.BodyHtml.Text, merger.Message.From.Name, merger.Message.From.Email, merger.Message.Recipients(0).Email, merger.Message.Recipients(0).Name);
                if (SMTPServer.UseQueue) {
                    merger.Message.StoreToFile((SMTPServer.QueuePath 
                                    + (System.IO.Path.GetFileNameWithoutExtension(System.IO.Path.GetTempFileName) + ".eml")));
                }
                else if ((tmpMain.SmtpServers.Count == 0)) {
                    ActiveUp.Net.Mail.SmtpClient.DirectSend(merger.Message);
                }
                else {
                    try {
                        if ((SMTPServer.Port == 587)) {
                            return ActiveUp.Net.Mail.SmtpClient.SendSsl(merger.Message, SMTPServer.Host, SMTPServer.Username, SMTPServer.Password, ActiveUp.Net.Mail.SaslMechanism.Login);
                        }
                        else {
                            return ActiveUp.Net.Mail.SmtpClient.Send(merger.Message, tmpMain.SmtpServers);
                        }
                        
                    }
                    catch (Exception ex) {
                        ActiveUp.Net.Mail.SmtpClient.DirectSend(merger.Message);
                    }
                    
                }
                
                return true;
            }
            
        }
        catch (System.Exception ex) {
            _lastError = ex;
            _Access.RaiseError(ex);
        }
        
    }
    
    return false;
}

from mailsystem.net.

logikonline avatar logikonline commented on July 16, 2024

any progress on this?

from mailsystem.net.

jstedfast avatar jstedfast commented on July 16, 2024

While you're at it, you should make sure to hide the Resent-Bcc header(s) as well.

Not sure if ActiveUp handles Resent-* headers, but it should. They override Sender/From/Reply-To/To/Cc/Bcc/Message-Id/Date when present.

@logikonline if you are in a rush, you could try using my MimeKit and MailKit libraries instead. Unfortunately, they are not API-compatible with MailSystem.NET, so it might be worth waiting for a fix depending on how much code you'd have to rewrite.

Hope that helps. I'm pretty obsessive-compulsive when it comes to bugs in my libraries, so they don't last long and my already-comprehensive unit tests keep expanding to cover more and more corner cases all the time.

from mailsystem.net.

logikonline avatar logikonline commented on July 16, 2024

I worked with Pierre on this in 2006 and some of the code around templates is mine. I'll fix it myself and dig into it.

from mailsystem.net.

reinaldocoelho avatar reinaldocoelho commented on July 16, 2024

Hi @logikonline , I'm not having much time at the moment, so I have not checked the problem yet.
If you can do the correction and send a PullRequest would be great.

I do accept your PullRequest to generate a new package.

Thank you.

from mailsystem.net.

jstedfast avatar jstedfast commented on July 16, 2024

Awesome to see things coming together :)

Have a Merry Christmas, guys!

from mailsystem.net.

reinaldocoelho avatar reinaldocoelho commented on July 16, 2024

Hi @jstedfast :-)
Have a Merry Christmas you too.
For you and all your family :-)

from mailsystem.net.

jstedfast avatar jstedfast commented on July 16, 2024

Thanks! :)

from mailsystem.net.

reinaldocoelho avatar reinaldocoelho commented on July 16, 2024

@logikonline thanks for PullRequest.
Meged on version 2.1.41.

from mailsystem.net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.