Magento 2.2.6 Change ‘From’ field of magento contact form email to the sender

Currently, when customer submit a contact form through our website, the “sent from” email address we received is our support@example.com. I would like to change the “send from” email address to be the email address the customer entered in the contact form. how do i achieve that in magento 2.2.6?

There is an solution to magento 1 here, but i can’t find the same file to edit for magento2. https://stackoverflow.com/questions/6188855/change-from-field-of-magento-contact-form-email-to-the-sender

my index.php file looks like this

contactsConfig = $contactsConfig;
    }

    /**
     * Dispatch request
     *
     * @param RequestInterface $request
     * @return MagentoFrameworkAppResponseInterface
     * @throws MagentoFrameworkExceptionNotFoundException
     */
    public function dispatch(RequestInterface $request)
    {
        if (!$this->contactsConfig->isEnabled()) {
            throw new NotFoundException(__('Page not found.'));
        }
        return parent::dispatch($request);
    }
}

It’s an issue with our help desk system, because the help desk ticket will created it using the “sent from” email address, thus all ticket are created with customer “support@example.com”

I’m thinking within …../Contact/Controller/Index/Post.php should be able to achieve that.

/**
 *
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace MagentoContactControllerIndex;
use MagentoContactModelConfigInterface;
use MagentoContactModelMailInterface;
use MagentoFrameworkAppActionContext;
use MagentoFrameworkAppRequestDataPersistorInterface;
use MagentoFrameworkControllerResultRedirect;
use MagentoFrameworkExceptionLocalizedException;
use MagentoFrameworkHTTPPhpEnvironmentRequest;
use PsrLogLoggerInterface;
use MagentoFrameworkAppObjectManager;
use MagentoFrameworkDataObject;
class Post extends MagentoContactControllerIndex
{
    /**
     * @var DataPersistorInterface
     */
    private $dataPersistor;
    /**
     * @var Context
     */
    private $context;
    /**
     * @var MailInterface
     */
    private $mail;
    /**
     * @var LoggerInterface
     */
    private $logger;
    /**
     * @param Context $context
     * @param ConfigInterface $contactsConfig
     * @param MailInterface $mail
     * @param DataPersistorInterface $dataPersistor
     * @param LoggerInterface $logger
     */
    public function __construct(
        Context $context,
        ConfigInterface $contactsConfig,
        MailInterface $mail,
        DataPersistorInterface $dataPersistor,
        LoggerInterface $logger = null
    ) {
        parent::__construct($context, $contactsConfig);
        $this->context = $context;
        $this->mail = $mail;
        $this->dataPersistor = $dataPersistor;
        $this->logger = $logger ?: ObjectManager::getInstance()->get(LoggerInterface::class);
    }
    /**
     * Post user question
     *
     * @return Redirect
     */
    public function execute()
    {
        if (!$this->isPostRequest()) {
            return $this->resultRedirectFactory->create()->setPath('*/*/');
        }
        try {
            $this->sendEmail($this->validatedParams());
            $this->messageManager->addSuccessMessage(
                __('Thanks for contacting us with your comments and questions. We'll respond to you very soon.')
            );
            $this->dataPersistor->clear('contact_us');
        } catch (LocalizedException $e) {
            $this->messageManager->addErrorMessage($e->getMessage());
            $this->dataPersistor->set('contact_us', $this->getRequest()->getParams());
        } catch (Exception $e) {
            $this->logger->critical($e);
            $this->messageManager->addErrorMessage(
                __('An error occurred while processing your form. Please try again later.')
            );
            $this->dataPersistor->set('contact_us', $this->getRequest()->getParams());
        }
        return $this->resultRedirectFactory->create()->setPath('contact/index');
    }
    /**
     * @param array $post Post data from contact form
     * @return void
     */
    private function sendEmail($post)
    {
        $this->mail->send(
            $post['email'],
            ['data' => new DataObject($post)]
        );
    }
    /**
     * @return bool
     */
    private function isPostRequest()
    {
        /** @var Request $request */
        $request = $this->getRequest();
        return !empty($request->getPostValue());
    }
    /**
     * @return array
     * @throws Exception
     */
    private function validatedParams()
    {
        $request = $this->getRequest();
        if (trim($request->getParam('name')) === '') {
            throw new LocalizedException(__('Name is missing'));
        }
        if (trim($request->getParam('comment')) === '') {
            throw new LocalizedException(__('Comment is missing'));
        }
        if (false === strpos($request->getParam('email'), '@')) {
            throw new LocalizedException(__('Invalid email address'));
        }
        if (trim($request->getParam('hideit')) !== '') {
            throw new Exception();
        }
        return $request->getParams();
    }
} 

Get an alias address in the sender field in Gmail

Let’s say I have two Google accounts: perso@gmail.com and pro@gmail.com.

I am connected to Gmail on my perso account. I have added pro as an alias address to send mail as, in the Gmail settings (Settings > Accounts and Import > Send mail as).

But, when I select the pro@gmail.com address when sending a mail, some of my contacts sometimes still see the original, perso@gmail.com address. And by checking the raw message, apparently, perso@gmail.com is still used in the Sender: field; pro@gmail.com is only present in the From: field.

How to make it so that the persons I send mail to never see the address perso@gmail.com? I tried checking and unchecking “Treat as an alias” in the Gmail settings, but this did not change.

Truffle – Error: sender doesn’t have enough funds to send tx

truffle(development)> app.waterTree(0, {value: .0000000000001})
Error: sender doesn't have enough funds to send tx. The upfront cost is: 1188468318377797839569896498995073351059306341883237633081 and the sender's account only has: 99909466300000000000

I’ve tried two different functions and got the same result:

function waterTree(uint id) public payable {
    trees[id].ethValue += msg.value;
    //valueOfTree[id] += msg.value;
}

I have gas price set to 1 wei on Ganache and the gas limit is sitting at 7m.

Reconstruct sender address from signature

I am using a service that wants me to verify that the data it returns to me is correct before I use it. The service returns something that looks like the following:

{
    "signature": {
        "v": "28",
        "r": "434602246437909971428234912666174277420709148030568091581149897760766791189",
        "s": "42424242"
    },
    "tx": {
        "value": 0,
        "data": "0x608060405234801561001057600080fd5b5060405161060a38038061060a833981018060405281019080805190602001909291908051820192919060200180519060200190929190805190602001909291908051906020019092919050505084848160008173ffffffffffffffffffffffffffffffffffffffff1614151515610116576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001807f496e76616c6964206d617374657220636f707920616464726573732070726f7681526020017f696465640000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506000815111156101a35773ffffffffffffffffffffffffffffffffffffffff60005416600080835160208501846127105a03f46040513d6000823e600082141561019f573d81fd5b5050505b5050600081111561036d57600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156102b7578273ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015156102b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001807f436f756c64206e6f74207061792073616665206372656174696f6e207769746881526020017f206574686572000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b61036c565b6102d1828483610377640100000000026401000000009004565b151561036b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001807f436f756c64206e6f74207061792073616665206372656174696f6e207769746881526020017f20746f6b656e000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b5b5b5050505050610490565b600060608383604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001925050506040516020818303038152906040527fa9059cbb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090506000808251602084016000896127105a03f16040513d6000823e3d60008114610473576020811461047b5760009450610485565b829450610485565b8151158315171594505b505050509392505050565b61016b8061049f6000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680634555d5c91461008b5780635c60da1b146100b6575b73ffffffffffffffffffffffffffffffffffffffff600054163660008037600080366000845af43d6000803e6000811415610086573d6000fd5b3d6000f35b34801561009757600080fd5b506100a061010d565b6040518082815260200191505060405180910390f35b3480156100c257600080fd5b506100cb610116565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60006002905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050905600a165627a7a7230582007fffd557dfc8c4d2fdf56ba6381a6ce5b65b6260e1492d87f26c6d4f1d041080029000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a000000000000000000000000090f8bf6a479f320ead074411a4b0e7944ea8c9c10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006363800000000000000000000000000000000000000000000000000000000000001040ec78d9e00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000c6b95513faf5b9cbf69bf3465d55944ec7669f600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
        "gas": "384096",
        "gasPrice": "1",
        "nonce": 0,
        "from": "0xc82eB0B907107F30fd6cedF1436B8498bD119Ce1"
    },
    "payment": "407096",
    "safe": "0x87488E025113a8a4C4f0c83E39d07a44A2Aa703C",
    "deployer": "0xc82eB0B907107F30fd6cedF1436B8498bD119Ce1"
}

The documentation says to reconstruct the sender/from address from the signature. I don’t control any of the accounts, is there any easy way to get the address from the provided information?

Gratis bulk email sender software to use on Windows 7?

I have created a mailing list in Microsoft Access 2010 that contains about 3000 emails in the following format:

enter image description here

As you see these are researchers from all over the world with different mail servers because of the different institutes and universities they work in. (I want to invite them to a special occasion)
I want to create a special gmail account for this task or use my university email that is like someone@ut.ac.ir and send them a short email like this just one time for each

Dear sir or madam
a pre written text

Is there any open source or free software that can be installed on a Windows 7 x64 laptop and do this tedious job of email sending for me with the following conditions?

  • The email should be sent just one time to each person without any
    mistake (They may block me if the program makes mistakes)

  • The email should go right into the inbox of the recipient and not
    into the spam folder

Up to know, I’ve found this, but I don’t know if it has all the features that I need.


Edit:
I prefer to change the email content as follows:

Dear firstname + lastname

pre written text

my signature as a student of university of Tehran

The sender address of a forwarded meeting request does not include “on behalf of” as expected

We have an Exchange 2010 environment with a mix of Outlook 2010 and 2013 clients. We have the following issue when forwarding meeting invites:

User A sends a meeting request to user B, user B forwards the meeting request to user C but it appears to have come from user A only – it does not show that it was sent by user B on behalf of user A.

Is there a way to change this so that user C will know that it was sent by user B? This is an issue for us because we had a situation where user B added some comments to the meeting invite before forwarding it to user C. User C thought that the comments were made by user A when in fact they were not.

I’m not finding much on the internet that directly addresses this issue, so I’m hoping someone here can lead me in the right direction, thanks!

Dynamic Sender Profile not working – Marketing Cloud

I am trying to implement a dynamic sender profile. I have followed instructions from answers on similar questions on stack exchange. From what I understood this should work. However, every time I do a test send the email in my inbox shows the business unit default from address and from name. I would be much appreciated if someone could tell me what I am doing wrong.

I did the following:

  1. Created a DE called “Dynamic_Sender_Profiles” with 3 attributes: “Locale”, “SenderName” and “SenderEmail”

Sendable data extensions that contain subscribers also have a “Locale” attribute.

  1. Created a HTML content block (CustomerKey = DynamicSenderProfile) with the following AMPscript:

    Var @fromname, @fromaddress, @locale, @row, @rows, @rowcount
    
    SET @locale = AttributeValue("Locale")
    
    SET @rows = LookupRows("ENT.Dynamic_Sender_Profiles", "Locale", @locale)
    SET @rowCount = rowcount(@rows)
    
    IF @rowCount > 0 then
    
    SET @row = row(@rows,1) 
    SET @fromname = field(@row,"SenderName")
    SET @fromaddress = field(@row,"SenderEmail")
    
    ENDIF
    

I’ve tested the AMPscript by itself by implementing it in a random email and it showed the correct values in the preview email.

  1. I created a sender profile with the following from name and from email:

From Name:

    %%[ContentBlockByKey("DynamicSenderProfile")]%%%%=v(@fromname)=%%

From Email:

    %%[ContentBlockByKey("DynamicSenderProfile")]%%%%=v(@fromaddress)=%%

constructor should be payable if you want to use message sender

Hi There i was running this code on remix javascript vm. But this gave me error on buy function that constructor should be payable if you want to use message sender. I can’t understand the mistake as I am still learning. Thanks for any help.

pragma solidity ^0.4.19;

contract Lottery {

    address[] tickets;
    address owner;
    uint ticketCount = 0;
    uint maxTickets = 100;


    function buy() public payable {
        require(msg.value == .001 ether);

        tickets.push(msg.sender);
        ticketCount++;
    }

    function currentTickets() public constant returns(uint currentNumber){
        return ticketCount;
    }
}