The "from" parameter of hook_mail() does not work in Drupal 8? - drupal-modules

I use hook_mail() to send html mails and everything works fine except the "from" parameter.
For the parameter "from" I would like to use an email that is different from the contact email of the site and so in the hook_mail I write:
$message['from'] = 'no-replyl#my-site.com';
But every time I send an email the "from" parameter is contact#my-site.com !

Related

How do search for multiple email address

I am logging into gmail via python and deleting emails. However when I do a search for two emails I get no results to delete.
mail.select('Inbox')
result,data = mail.uid('search',None '(FROM target.com)')
The above works and will find and delete any email that had target.com in the from address. However when I send in another email address I get nothing.
result,data = mail.uid('search',None '(FROM "target.com" FROM "walmart.com")')
Yes I have both target.com and walmart.com emails in my inbox.
Gmail search is exactly like Searching in the gmail website. If you open that and click the arrow down buttom in the search field you can test things.
That being said searching on more then one address is not going to work as its going to look for emails that are by both people. Not all emails containing one or the other.
The following will look for mails that both come from tom and jon. probably not possible as you cant have two senders
from:(tom#gmail.com,jon#comcast.net)
where as will return all mails that come from gmail.com
from:(gmail.com)
will only return mails sent from gmail.com and comcast.net which inst possible
from:(tom#gmail.com,comcast.net)
your going to have to make two requests.
You can search set this type of filter:
from:(demo#gmail.com OR demo1#yahoo.com)

Macro send email, change 'from' Display Name but NOT email address

I have this:
.SentOnBehalfOfName = """Customer Service"" <customerservice#testing.test>"
the name "Customer Service" is officially associated with the email address. I'd like to change that display name to something else but keep using the same email address like this:
.SentOnBehalfOfName = """ABC Event CS"" <customerservice#testing.test>"
or
.SentOnBehalfOfName = """XYZ Event CS"" <customerservice#testing.test>"
But it always uses the default display name instead of the one I specify. Is it possible to achieve this in some way?
Exchange always uses the default name and the primary SMTP address when sending. If you want to change the display name and/or select one of the proxy addresses from a particular mailbox, sending through SMTP is the only option if you need to do that programmatically. In case of an end user, you can use a product like Proxy Manager (I am its author).

addressused on email "from" attribute

I'm using a pre-operation plugin on create of email to change the entity reference on the email's "from" attribute.
This is the code I use for the setting:
((EntityCollection)entity.Attributes["from"]).Entities[0].Attributes["partyid"] = erQueue; //erQueue is an entityReference of a certain queue
I also want the email to be sent from the queue email adddress, and not from the original sender's address.
should I also set the "addressused attribue of the "from" activityparty, or would it happen automatically?
CRM should default the email address used to primary email address of the selected record.
I've only used addressused in the past when I wanted to use an email address other than the primary email address of the selected record.
So in your case I don't think you need to set the addressused.
Slightly old documentation but still true and relevant I believe.
activityparty.addressused Property
The property activityparty.partyid contains the ID of an account,
contact, lead or systemuser. For account, contact or lead, the
property emailaddress1 is used as the default value for the e-mail
address. If this value is blank, emailaddress2 is used, and so on. For
systemuser, the default e-mail address is internalemailaddress.
To override this default, you can specify an alternate address as the value for addressused. For example, if you set addressused to the
value "someone#example.com", that e-mail address will be used.
After I checked, the email was sent with the email address of the original system user in the "from" field. So I had to change the addressused of the activityparty in the from attribute:
((EntityCollection)entity.Attributes["from"]).Entities[0].Attributes["addressused"] = sQueueEmailAddress;

Gmail add spaces in link href attribute

Using PHPMailer to send an email, when I view the email in Gmail in the href attribute of the link is displayed a space (%20). For example:
http://www.domain.it/page.php?u%20tente=5691457&annuncio=54ad79ccc9&codice=1457
HTML code that is passed to PHPMailer does not contain space.
I add this problem today. I had a link that was more than 998 octets long and the SMTP server splitted it.
Check that the header of your email Content-Transfer-Encoding is set to something different than 7bit.
http://en.wikipedia.org/wiki/MIME#Content-Transfer-Encoding

How do I search by "sender" or "from" in my Inbox

I get tons of email (> 1 per minute) and often I know "who" sent me the email but not when so when I want to find an email I have to "sort" my entire Inbox by sender and then start scrolling through the emails from that person. In the "form" search there is the ability to search by field but I cannot find the right field/parameters to search. For instance here is an example of the following fields:
DisplayFrom is "CN=John Doe/O=ACME"
DisplaySent is "CN=John Doe/O=ACME"
From is "CN=John Doe/O=ACME"
INetFrom is "John_Doe#acme.com"
So if I select any of these fields in the "Search in View" area of the Inbox and enter "field DisplayFrom contains Doe" it does not match anything.
Anyone have any ideas on how to do this with Sender/From. It seems to work with Subject but that's not a common use case for me.
Yes, sorry should have posted Lotus Notes version ... Release 8.5.3 on Linux 32 (but I've tested it on Win32 as well and fails there too).
field From contains SenderName works for me and returns results (using a real name instead of SenderName, of course):
You can create a view based on All Documents that is categorized on sender. Perhaps this can make it easier for you to find your emails from a specific person.

Resources