Mailhandler authenticate on username or email?

mariagwyn - February 2, 2009 - 02:39
Project:Mailhandler
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Ian Ward
Status:active
Description

I am trying to set up mail2web, but first setting up mailhandler. I am running into an odd set of problems:

I have successfully setup mailhandler to retrieve from a gmail mailbox I am using to catch site emails. In the mailbox, I have simple commands:
type: page
status: 1

I have created an account, "Mail" which ONLY has permission to administer/create nodes. When I send from this account, a page is created, submitted by GUEST. It makes no difference what I put in "From: Header," it is ALWAYS created as "guest".

If I send an identical post from my admin account, also a gmail account, I receive the error: "The username Maria McDowell does not exist." Note that "Maria McDowell" is my gmail account name, which corresponds to my gmail account. My gmail account is registered as the site admin account (user 1), whose username is "admin." It does not appear that mailhandler is authenticating against the email, but the username. This means that users cannot easily post from their email account.

I suspect it is also why I can't get mail2web to post at all, but I think I need to solve this first.

Thanks,
Maria

#1

Ian Ward - February 2, 2009 - 14:04
Assigned to:Anonymous» Ian Ward

Hi Maria, I believe this is all related to mail2web and how it is used. I will try to resolve all the issues over here http://drupal.org/node/367747

thanks
Ian

#2

mariagwyn - February 2, 2009 - 18:14

Ian, I will check the other post, but I should have clarified in this one: all these problems occur when mail2web is TURNED OFF. I figured there would be too many issues, and i wanted to at least get one working before the other, so I tried mailhandler by itself first (well, actually, I turned off m2w when I realized there was a more significant problem).

m

#3

mariagwyn - February 4, 2009 - 04:30

Is anyone having this problem with mail2web turned off? Any insight into what the issue is on my site? I am stuck...

Thanks,
Maria

#4

Ian Ward - February 11, 2009 - 21:38

I have created an account, "Mail" which ONLY has permission to administer/create nodes. When I send from this account, a page is created, submitted by GUEST. It makes no difference what I put in "From: Header," it is ALWAYS created as "guest".

The error you are getting "The username %name does not exist" is coming from the node module. For whatever reason your user is not allowed to create the node. This could happen for several reasons. Can you try posting the same node type on the site using that user account and see if you're able, as opposed to trying to email it via mailhandler? If this fails, then you may have some permission problem. Another thing that comes to mind is how you're telling mailhandler into which OG group it should post the content when received via mailhandler (when not using mail2web). Are you using some command in the mailhander command textarea to handle this?

The way that mailhandler works is that it looks who the email is from by looking in the mail header, finds the from email address, then looks in Drupal to see to which user that email address is assigned. It then adds whatever user it finds to the $node->name property before it tries to programatically submit the node. If the problem is not with permissions, then perhaps it has something to do with unusually formed headers in the email. However, I've been testing mailhandler and mail2web using gmail addresses, and it seems to handle their headers fine. Are you using the gmail web client, or some other mail client? Another thing to try is using email addresses from a different provider or with a different email client.

Ian

#5

Ian Ward - February 11, 2009 - 23:10

Maria, can you also do the following for me:

1. Respond to one of the notifications.
2. Instead of having the Drupal site process it, go to the actual mailbox (at gmail.com or wherever the email is hosted) of the email address that is assigned to the mailhandler mailbox, view the full headers of the email that you sent in step 1, and paste here, or send it to me in my contact form if you do not want to post all that info online.

I'd like to look at the headers to see if there is something happening that could make mailhandler fail when it tries to get the uid for the person who sent the email (this is done in mailhandler_get_fromaddress in mailhandler.retrieve.inc)

thanks,
Ian

#6

mariagwyn - February 21, 2009 - 19:52

Ian,

Sorry for the delay in responding, I put this aside b/c I wasn't getting anywhere. So here goes again.

I TURNED OFF mail2web, so everything below applies to MAILHANDLER only.

I have a working liststerv mailbox (gmail). I sent, to the listserv email an email from my ADMIN (that is, my user 1) account email which has full posting privileges. I sent it from gmail's web interface rather than my apple mail. The messages is successfully received. But I receive the following error:

Node submission failure: myemail@gmail.com may not create page items.

But this account can do EVERYTHING on the website.

Here is the slightly edited header information:

from Maria McD... <myemail@gmail.com>
to my.listservs@gmail.com
date Sat, Feb 21, 2009 at 11:43 AM
subject new page 21-Feb
mailed-by gmail.com

#7

gfc62 - April 2, 2009 - 00:49

Ian,
I didn't want to create a new issue when this one is already open but let me know if you'd rather I did so.

I'm having the same problem without mail2web installed.

I get the error below:

Type mailhandler
Date Wednesday, April 1, 2009 - 19:53
User Anonymous
Location http://example.com/drupal/?q=batch&id=22&op=do
Referrer http://example.com/drupal/?q=batch&op=start&id=22
Message Node submission failure: account@example.com may not create page items.
Severity warning
Hostname 63.175.130.15
Operations

I've tried with 3 different email addresses including admin.

I've checked the email header to verify the from: address is the same as in my user settings. I checked the email addresses in the user table they're the same

If I grant page node create permissions to the anonymous role the node gets created.

Let me know if I can supply any more info to assist.

#8

gfc62 - April 2, 2009 - 02:03

I have Mailhandler working now.

I took a look at mailhandler.retrieve.inc and saw the test for $mailbox['security'] == 1

This clued me in that I had misunderstood what the 'Security:' setting in the configuration settings (mailhandler/edit) is supposed to do.

As a suggestion, maybe you could call watchdog with a 'Wrong password for user xxx' message when user_load(array('mail' => $mail, 'pass' => $pass)); fails.

I originally turned 'Security:' on assuming it was for the email password. After turning off 'Security:' my emails are being imported correctly.

Perhaps this is the original poster's issue as well?

#9

a_c_m - April 22, 2009 - 23:35
Category:support request» feature request

I agree here, a 'Wrong password for user xxx' message when user_load(array('mail' => $mail, 'pass' => $pass)); fails would help a lot.

for me the issue was i assumed the command for password was password: not pass:

 
 

Drupal is a registered trademark of Dries Buytaert.