I am using the Zend_Mail_Message class to display emails inside my PHP application and I am able to output the subject, content, date and even the name of the sender (using $message->from) but I can't figure out how to get the person who sent the message The email address. The documentation did not help, Google search found a million results, how to use Zend to send a message, but there is no information about getting the address to send the message.

Solution:

edit:

This is how I ended up doing it. After some digging, I found the sender's email in a field called"Return Path". Unfortunately, there is a dash (WTF? ?) So to access it, I have to do this:

$return_path ='return-path';
$message-> reply_to = $zendMessage-> $return_path;

Using the return path can cause problems with some emails, especially those from non-reply accounts (mail-noreply @ gmail.com, member @ linkedin.com, etc.). These addresses will end up looking like this:

m-9xpfkzulthma[email protected]

…Obviously it cannot be displayed in the"From"field on the front end. Email clients such as Apple Mail and Gmail display mail-[email protected] or [email protected], which is also my goal.

In any case, after some research, I found that the'from' field in the Zend Mail Message object always looks like this:

"User account name"<[email protected]\u0026gt;<<> is what I am after, but only from $$zend_message->from $ only gave me the user's account name (hence my original question). After After more games, this is how I ended up working:

$from = $zendMessage->from; $start = strpos($from,'<'); $email = substr($from, $start, -1); $result = str_replace('<','', $ email);

Hope this will frustrate some people. If anyone knows an easier way, please let me know.

php-How to get the sender's email address from Zend_Mail_Message? Related posts

  1. java se part of the content summary thinking mind map

    likecollectshareArticle reportRuthless published 12 original articles, received 8 likes, and visited 315 private messages. ...

  2. How to Secure Linux Servers with SE Linux

    Security is an extremely important aspect of software development, server management, and application development these days. And if you use Linux, you're in luck – it comes with an excellent feature called SE Linux that helps you add an additional layer of security.What is SE Linux?SE Linux was dev ...

  3. The best and shortest books on C/STL/C#/J2SE to prepare for job interview/test

    I am a software developer with 10 years of business experience and I am satisfied with almost all imperative languages. But I realize that most employers do not like candidates who can provide quality software, but those who have received training People, they will answer questions such as"ten differences between pointers and references in C"or"what this messy code snippet will print". Last time I read a book about C in middle school 15 years ago The book, yes, that is Bjarne Stroustrup. But tod ...

  4. Java EE and Java SE: The version does not match?

    This question has been answered here:&gt; Correlation between Java EE / J2EE to J2SE / JDK versions 3 I have always wondered if there is a correlation between Java EE versions running on top of Java SE. I have found this question, But the answer there is outdated and unsatisfactory. My question is:& ...

  5. Java SE - Clever way to achieve "plug and play" for different library modules

    I'm trying to do something smart. I'm creating a weather app where we can replace the weather API with another weather API without affecting the codebase. So I'm starting with a Maven project with multiple modules.I have a Base module that contains an Interface class and a Base class. The Interface ...

  6. Java SE

    1. Java SE1. Java basic data types and their corresponding wrapper classesThe wrapper class corresponding to the basic data type * byte Byte * boolean Boolean * char Character * int Integer * long Long * short Short * float Float * double Double1.2 Autoboxing and Autounboxing// 1. Autoboxing: // The ...

  7. Java SE---Collection

    1. List2. Set3. Mappackage com.an.collection;import java.util.*;import java.util.Map;/** * @description: * @author: anpeiyong * @date: Created in 2020/3/4 9:30 * @since : */public class MapTest {public static void main(String[] args) {// iteratorTest();// iteratorTest2();// foreachTest();// foreachT ...

  8. Yosemite – where else can I download the old Java SE 6 runtime?

    I just upgraded to OSX Yosemite.I am trying to open my Adobe Flash CS6 application but it saysTo open"Flash"you need to install the legacy Java SE 6 runtime.A simple google search yielded this page: https://discussions.apple.com/thread/6604985There are several links there - however, they all lead to ...

  9. Introduction to Java SE (15)-Modifiers and inner classes

    Introduction to Java SE (15) &emsp;&emsp;-Blog Garden of Modifiers and Internal Class iwehdio: https://www.cnblogs.com/iwehdio/1. Packages and modifiersSystem classification of java filesFeatures of the package:Can have a multilayer structure. For com.demo, com and demo have a two-layer package structure.The file names under different packages can be repeated.The package declaration must be the first line of code.The classes under the same package can be accessed directly.Classes under differen ...

  10. Introduction to Java SE (1)-Variables and data types

    Introduction to Java SE (1) &emsp;&emsp;-Variables and data types iwehdio's blog garden: https://www.cnblogs.com/iwehdio/1. Introduction to JavaJava SE Standard Edition, normal desktopJava EE Enterprise Edition, Web applicationCross-platformPrinciple: Java Virtual Machine JVMPlatform: refers to the operating systemJREThe full name is Java Runtime Environment, java runtime environment. It is a necessary condition for running java programs.Including Java virtual machine JVM and core class library ...

  11. Java SE Java EE Java ME mean? What's the difference?

    The three branches of java:Java SE (Standard Edition) is oriented to PC-level application development; such as QQ DoudizhuJava EE (Enterprise Edition) for enterprise-level application development; large e-commerce projects such as TaobaoJava ME (Micro Edition) is oriented to embedded application dev ...

  12. ant-What is the best way to compile J2ME and J2SE applications from the same code base?

    I'm trying to build an application for J2ME and J2SE. The presentation code will obviously be different, but I want to keep the logic as common as possible.My plan is to use Ant or Antenna's pre-processor to select J2ME or J2SE Graphics objects, and this class is the only intersection between my log ...

  13. The difference between Fast-Fail and Fast-Safe of Java SE [Collection and Multithreading/Enhancement For]

    statement&emsp;&emsp;Features: Analysis based on JDK source code.&emsp;&emsp;Research is time-consuming and laborious. If you need to reprint or abstract, please clearly indicate the source to respect the labor research results: Blog Park-https://www.cnblogs.com/johnnyzen/p/10547179.html, infringeme ...

  14. How to master Java (J2SE articles)

    often see some people say that they have mastered Java, but it may be difficult for them to use Java to do an actual project. Here, I am bold based on my own understanding. Put forward some of your own standards for mastering Java. Of course, for novices, you can also provide a reference for what yo ...

  15. Introduction to Java SE (11)-IO and collection exercises

    Introduction to Java SE (11) &emsp;&emsp;-IO and collection exercises iwehdio's blog garden: https://www.cnblogs.com/iwehdio/1. IO practiceSteps to key in student information, save it in the collection, and then save it in the file:Define the student class.Create a collection object.The writing method realizes keyboard entry of student information, and adds the student object as an element to the collection.Create an output buffer stream object.Traverse the collection, get the information of ea ...

  16. Java SE, the beginning of a dream

    Java SE is the abbreviation of Java Platform, Standard Edition (also known as Java 2 Platform), used to develop and deploy desktops, servers, and Java applications embedded in devices and real-time environments. Java SE includes a class library for developing Java Web services. At the same time, Java SE provides a foundation for Java EE and Java ME.1. What are the characteristics of object-oriented?EncapsulationThe most common is to encapsulate the property privately in a class, which can only b ...

Recent Posts

  1. javascript – Why does ValidatorValidate() validate all RequiredFieldValidator controls on the page?

    Why does ValidatorValidate(v) validate all RequiredFieldValidator controls on the page in the following code? It should only execute RequiredFieldValidator1 and not RequiredFieldValidator2. This is the code.Solution:You need to return something from check(), otherwise, it is running it, then passes ...

  2. javascript-How to use a script to synchronize Google Calendar and spreadsheets

    I'm trying to create a Google Apps Script to save Google Calendar and"Master Spreadsheet"simultaneously on Drive-is this possible? I found these two posts:&gt; http://blog.ouseful.info/2010/03/04/maintaining-google-calendars-from-a-google-spreadsheet/ &gt; http://blog.ouseful.info/2010/03/05/grabbin...

  3. php-How to check the value of simplexml object

    I have a simple array of xml objects. I am writing the following codeArray([ID] =&gt; 1992109[Title] =&gt; A Equipa do MAIS[Description] =&gt; SimpleXMLElement Object ())Now, how can I check the description value in this array, if it exists or does not exist the value of the value.Solution:To verify...

  4. 1001 The (3n+1) conjecture that kills people without paying for their lives is implemented in python

    Callatz conjecture:For any positive integer n, if it is even, cut it in half; if it is odd, cut (3n+1) in half. This has been repeatedly cut down, and finally n=1 must be obtained at a certain step. Karaz announced this conjecture at the World Congress of Mathematicians in 1950. According to legend,...

  5. PHP-Is it possible to restrict the Azure CDN IP address?

    I am going to build a new cloud in sky blue to be used as an image server for multiple websites. What I created is a storage, endpoint, cdn-everything is ok. I set up an Ubuntu host in the middle, which will use apache2 and php Resize the image from the original size in storage according to the requ...

  6. MATLAB program of canopy clustering algorithm

    MATLAB program of canopy clustering algorithmKailugaji-Blog Park http://www.cnblogs.com/kailugaji/1. Introduction to canopy clustering algorithmThe Canopy clustering algorithm is a simple, fast and accurate method for grouping objects into classes. Each object is represented by a point in the multi-...

  7. java-How to reload property files in Spring 4 using annotations?

    I have a simple application where I use several properties files to get content edited by other users (links to websites etc.).My class for loading properties looks like this:@[email protected]("classpath:salestipsWhitelist.properties")public class SalestipsWhitelist {@AutowiredEnvironmen...

  8. javascript-How to create an instance of a subclass from a superclass?

    I am creating a class and its subclasses, and I need to call the static method of the parent class to return the child instance.class Animal{ static findOne(){ // this has to return either an instance of Human // or an instance of Dog according to what calls it // How can I call new Human() or new D...

  9. part_48: python_collection

    1. The definition of collectionThe elements in the collection are not repeatables = {1,2,3,1,2,3,4,5} print(s)print(type(s)) operation result: {1, 2, 3, 4, 5}Empty collections2 = {}print(type(s2))s3 = set([])print(s3)print(type(s3)) operation result: ##s2 is a dictionary, not a collection set()Colle...

  10. php-How to receive emails on Google Compute Engine

    Google's Compute Engine blocks all outgoing email ports by default. Quote from Compute Engine DocumentationCompute Engine blocks or restricts traffic through all of the following ports/protocols between the Internet and virtual machines, and between two virtual machines when traffic is addressed to ...