Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Received: from in Original Message in Gmail #2933

Closed
iamved777 opened this issue Jul 21, 2023 · 1 comment
Closed

Multiple Received: from in Original Message in Gmail #2933

iamved777 opened this issue Jul 21, 2023 · 1 comment

Comments

@iamved777
Copy link

Hi!
I am trying to send emails using PHPMailer. Its working fine but in Gmail when I have checked, Its showing me Multiple Received From information which is exposing my server information instead of SMTP server.

Delivered-To: [email protected]
Received: by 2002:a05:6a20:289f:b0:134:8df0:38f2 with SMTP id q31csp2499936pzf;
        Thu, 20 Jul 2023 21:07:59 -0700 (PDT)
X-Google-Smtp-Source: APBJJlGUdtfqZSKhrqY5gy30KUrovK+JgSQfyS1KcTm3lLSvehmvEI+MrNARPjPFzDuDpfyfmebP
X-Received: by 2002:a05:6870:3282:b0:1b0:2d25:f5ae with SMTP id q2-20020a056870328200b001b02d25f5aemr898724oac.47.1689912479685;
        Thu, 20 Jul 2023 21:07:59 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1689912479; cv=none;
        d=google.com; s=arc-20160816;
        b=raNw8UyJ273/lmRHrYlSSOP/4tjrWEZgOK2NGlqkYhQfGkhv/LQfDQJr0fbsOD6Q4u
         IQUMZhJLVmCSXI6NkhLnJtNTs6l/w4NsIA3gRqdbMm725WRugwItWThCO/hVZBELVmHT
         bL67mPDppKSGOn6ynGrx7HCjwDpyPyubg2dCv65Z8u/jjXqXGmz26FFK4Q3NEWWKMLmQ
         64J/LotDOWkWzZ7LVpSpmg9KsnY1LZqtMeutfZZAoO4DU8akfW9OwQtGb9LdexzlJks2
         Gel4UIfrPkaFGAJx4cEtlaY54KYTkk1Ui6adsMCjcUp1hDgz3ZstjSp6cDPsLaUv+zTO
         bCDw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=mime-version:message-id:subject:from:to:date:dkim-signature;
        bh=bIDjwW/gXuMp99hIYSKpyBdpvCx8uFr77qlql7C/iAo=;
        fh=38P0F8Oks2zx3dfUfXd63HKtV+2/22/mUQuXfmmtf+4=;
        b=H3jfjyV018ufJ1PpmlRMLMuVVRHWMwbzy8goD3Xbo2rhaZQ8yzAo5S9vXL3cgO639Z
         C2/q5GoWIerlzGNWVUySbwuBhYJ9ZuZiaEG14aDZvc9V03JthfwS3sYaBXoFIdgCLZDV
         KH8V1iWQMMmX232X/pJZSMKPHo4qeYmkNkLNNXGnCBA1Ncc75+fY37djD+pL64PPrtN+
         Sv51ES40zJTtiLH3w/M5xcyrTKm/Rhur2W220bNFXaMs6l/mzp64gnXL/v+y47OZX9Gw
         hp7zM7AyBa2/HFVmE/LpzqvGzFxx36HpeXV3kheFBJxp/WOunLyUHC5lRXcwTqRswl6o
         kzIw==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass [email protected] header.s=mail header.b=dHe3YPZJ;
       spf=pass (google.com: domain of [email protected] designates 02.02.02.02 as permitted sender) [email protected];
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=examplesmtp.com
Return-Path: <[email protected]>
Received: from server.examplesmtp.com (server.examplesmtp.com. [02.02.02.02])
        by mx.google.com with ESMTPS id z10-20020a05687041ca00b001baa7691f53si1163446oac.314.2023.07.20.21.07.59
        for <[email protected]>
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Thu, 20 Jul 2023 21:07:59 -0700 (PDT)
Received-SPF: pass (google.com: domain of [email protected] designates 02.02.02.02 as permitted sender) client-ip=02.02.02.02;
Authentication-Results: mx.google.com;
       dkim=pass [email protected] header.s=mail header.b=dHe3YPZJ;
       spf=pass (google.com: domain of [email protected] designates 02.02.02.02 as permitted sender) [email protected];
       dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=examplesmtp.com
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=examplesmtp.com; s=mail; h=Content-Type:MIME-Version:Message-ID:Subject: From:To:Date:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=bIDjwW/gXuMp99hIYSKpyBdpvCx8uFr77qlql7C/iAo=; b=dHe3YPZJi1MdY5hFwOwcwbaPtv TH17w7bJm2uqc188DLBrZX6e59UIXGCOX4F2rc7idgInsH1LjaZ3fmntx3dmQfTZySobf5CyLjim6 xYtUkdq2U9SZy7HBW8U+IGbC3ethu+koRnxb2rspyQ6/2vkqv6AB8Q+A/OpL1KpHEEGk=;
Received: from my.server.com ([01.01.01.01] helo=server.examplesmtp.com) by server.examplesmtp.com with esmtpsa
  (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from <[email protected]>) id 1qMhQt-005Xhj-Bj for [email protected]; Fri, 21 Jul 2023 04:07:59 +0000
Date: Fri, 21 Jul 2023 04:07:58 +0000
To: [email protected]
From: Darnell Collins <[email protected]>
Subject: Update on Your Ticket: ID {{ random_number }}
Message-ID: <QiIFKmlxcLpJXTocKXTuPXif2UxTtLsMhwTCk4ELURQ@server.examplesmtp.com>
X-Originating-IP: server.examplesmtp.com
MIME-Version: 1.0
Content-Type: text/html; charset=iso-8859-1

I hope this email finds you well. I wanted to inform you that we have made some recent updates to your ticket, ID {{ random_number }}, and would greatly appreciate it if you could take a moment to review and acknowledge the changes.

If you have any questions or require further assistance, please don't hesitate to reply to this email. We are here to help.

Thank you for your attention to this matter.

Best Regards,

and my code is like this

$mail = new PHPMailer(true);

    try {

        $mail->SMTPDebug = 4;
        $mail->isSMTP();
        $mail->Host       = $s_server;
        $mail->SMTPAuth   = true;
        $mail->Username   = $s_username;
        $mail->Password   = $s_password;
        $mail->SMTPSecure = $s_protocol;
        $mail->Port       = $s_port;
        $mail->Hostname = $s_server;
		$mail->XMailer = ' ';
		$mail->addCustomHeader('X-Originating-IP: '.$s_server);
        
        $mail->SMTPOptions = array(
       'ssl' => array(
                'verify_peer' => false,
                'verify_peer_name' => false,
                'allow_self_signed' => true
            )
        ); 
    
        //Recipients
        $mail->setFrom($s_from, $s_from_name);
        $mail->addAddress($email);
        
        $mail->isHTML(true);
        $mail->Subject = $subject;
        $mail->Body    = $template;

        $mail->send();
    } 
    catch (Exception $e) {
        
    }

Screenshot_1022

I think its signing multiple time. I do not know how to prevent it. Let e know if anyone here can help me for the same.

Thanks!

@Synchro
Copy link
Member

Synchro commented Jul 21, 2023

This is normal SMTP behaviour. Each server that receives a message on its route from sender to receiver adds a Received header. PHPMailer has nothing to do with adding these headers as it happens at the receiving end. One way around it is to skip the intermediate server that it goes through and deliver it directly to the final one, but that may not be possible, and largely avoids one of SMTP's robustness advantages.

@Synchro Synchro closed this as completed Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants