email-headers

Method for parsing text Cc field of email header?

烂漫一生 提交于 2019-12-04 08:25:14
I have the plain text of a Cc header field that looks like so: friend@email.com, John Smith <john.smith@email.com>,"Smith, Jane" <jane.smith@uconn.edu> Are there any battle tested modules for parsing this properly? (bonus if it's in python! the email module just returns the raw text without any methods for splitting it, AFAIK) (also bonus if it splits name and address into to fields) Martin Tournoij There are a bunch of function available as a standard python module, but I think you're looking for email.utils.parseaddr() or email.utils.getaddresses() >>> addresses = 'friend@email.com, John

How to format an email 'From' header that contains a comma

岁酱吖の 提交于 2019-12-03 11:03:56
问题 The standard way to format the 'From' email header is From: John Doe <john.doe@example.com> But what to do if there's a comma in the name? From: John Doe, chief bottle washer <john.doe@example.com> If I do that, my MTA automatically converts this into: From: John@this.server.com, Doe@this.server.com, chief bottle washer <john.doe@example.com> My first guess is to use double-quotes around the full name, but I can't find any official documentation confirming this and I'd like my emails to be

Using Gmail message source, generate direct link

安稳与你 提交于 2019-12-03 07:40:28
问题 So using the gmail message source is it possible to generate, a link to the message/thread in GMail's own interface? on http://productforums.google.com/forum/#!topic/gmail/goChl1gG0NQ they use the following https://mail.google.com/mail/#all/<HexEncodeMessageID> Is this related to the Message=ID header found in the mail's source? Message-ID: <SomeID@SomeID.mail> The discussion Find Gmail url-IDs via IMAP seems to only give IMAP based solutions. 回答1: Update This bookmarklet no longer works. See

Convert data from email header

蹲街弑〆低调 提交于 2019-12-03 07:19:02
Does anyone could help me how to convert data from email header? I have the next date format from email header: Wed, 28 Apr 2010 21:59:49 -0400 I need to convert them into mysql Date, or timestamp. Thanks! You should be using DateTime for this, specifically DateTime::createFromFormat() : $str = 'Wed, 28 Apr 2010 21:59:49 -0400'; $date = DateTime::createFromFormat( 'D, d M Y H:i:s O', $str); Now, you have a Date object in $date , and you can grab the unix timestamp (if that's what you want), or you can format it into a date for MySQL. echo $date->getTimestamp(); // Outputs: 1272506389 echo

Using Gmail message source, generate direct link

孤街醉人 提交于 2019-12-02 21:06:34
So using the gmail message source is it possible to generate, a link to the message/thread in GMail's own interface? on http://productforums.google.com/forum/#!topic/gmail/goChl1gG0NQ they use the following https://mail.google.com/mail/#all/<HexEncodeMessageID> Is this related to the Message=ID header found in the mail's source? Message-ID: <SomeID@SomeID.mail> The discussion Find Gmail url-IDs via IMAP seems to only give IMAP based solutions. Update This bookmarklet no longer works. See Benjamin Ziepert's update . Original Answer I decided to make a bookmarklet to help automate this.

Is there an error in PHP's imap_fetch_overview()-function when reading headers with brackets?

主宰稳场 提交于 2019-12-01 16:28:38
I'm sending an E-Mail in PHP using the following code: <?php error_reporting(E_ALL); # write mail ############################################################################### $recipient = "mail@server.tld"; $subject = mb_encode_mimeheader("Subject äöü "); $text = "Hallo"; $header = "From:".mb_encode_mimeheader("Name with [], ÄÖÜ and spaces")." <webmaster@example.com>" . "\r\n" . "Reply-To: webmaster@example.com" . "\r\n" . "X-Mailer: PHP/" . phpversion(); // send e-mail mail($recipient, $subject, $text, $header); ?> Afterwards I try to read the e-Mail using imap_fetch_overview() in the

Is there an error in PHP's imap_fetch_overview()-function when reading headers with brackets?

倾然丶 夕夏残阳落幕 提交于 2019-12-01 15:27:00
问题 I'm sending an E-Mail in PHP using the following code: <?php error_reporting(E_ALL); # write mail ############################################################################### $recipient = "mail@server.tld"; $subject = mb_encode_mimeheader("Subject äöü "); $text = "Hallo"; $header = "From:".mb_encode_mimeheader("Name with [], ÄÖÜ and spaces")." <webmaster@example.com>" . "\r\n" . "Reply-To: webmaster@example.com" . "\r\n" . "X-Mailer: PHP/" . phpversion(); // send e-mail mail($recipient,

PHP Mail Headers

不羁岁月 提交于 2019-12-01 11:12:29
问题 Essentially what I'm trying to do is attach a file to an email I'm sending out. Simple enough, right? For some reason or another it does not like the following code (presumably because of the headers). Can anyone help? Thanks in advance!! $subject = "File ".date("Ymd"); $message = "NONE"; $filename = "test.csv"; $content = chunk_split(base64_encode(file_get_contents($filename))); $uid = md5(uniqid(time())); $name = basename($file); $header .= "MIME-Version: 1.0\r\n"; $header .= "From: noreply

Custom Email Headers in Laravel 4

霸气de小男生 提交于 2019-11-30 13:58:34
I can't seem to locate the method within the Laravel 4 docs/Email API where I can add custom headers to an email. For example: Mail::send('emails.welcome', $data, function($message) { $message->to('foo@example.com', 'John Smith')->subject('Welcome!'); $message->headers('X-Tags', 'tag1 tag2 tag3'); }); Does anyone know how this can be done? As far as I know there's no way to add custom headers without reaching in to Swift Mailer. Try something like this. $message->getSwiftMessage()->getHeaders()->addTextHeader('X-Tags', 'tag1 tag2 tag3'); It doesn't look pretty but from looking through the

Set the Message-ID mail header in Rails3 / ActionMailer

流过昼夜 提交于 2019-11-30 06:47:40
I would like to alter the Message-ID header that is in the header portion of an email sent from a Ruby on Rails v3 application using ActionMailer. I am using Sendmail on localhost for mail delivery. Do I configure this in Sendmail or ActionMailer? Where do I configure this (if it is ActionMailer): a file in config/ folder or a file in app/mailers/ folder? Teddy's answer is good, except that if you actually want each message to have a different ID, you need to make the default a lambda. In the first block of code in his answer, it calculates the message-ID once, at init, and uses the same one