| Author |
Post |
|
|
#1 Thu Sep 07, 2006 3:54 pm
|
|
Member
Registered: Sep 2006
Posts: 1
|
Hello there, When users register, or for any other mail function for that matter, the mail() function is not working and the reason is that my hosting (in order to avoid spamming) makes me add the following to the mail function. mail(email_address,subject,body,headers, "-fusername@domainname.com"); I have modified the function.php with: if ( !mail($to, $subject, $body, join($cr, $headers), "-fusername@domainname.com") ) Of course I replace my username and domainname with the correct one. Is that the right way to do it? Why is not working? I cannot use SMTP. Thanks Jose « Last edit by Dietrich on Tue Sep 19, 2006 3:42 pm. »
|
|
|
#2 Fri Sep 08, 2006 1:30 pm
|
|
Developer
Registered: Apr 2004
Posts: 2224
Location: Belgium
|
There is more than one email function: if ( !mb_send_mail($to, $subject, $body, join($cr, $headers)) ) ... if ( !mail($to, $subject, $body, join($cr, $headers)) ) You should add it to both. If it doesn't work you should contact your host and request their assistance for this matter, since this isn't a UseBB problem and we can not really help in resolving this.
|
|
|
#3 Wed Sep 13, 2006 6:49 am
|
|
Member
Registered: May 2005
Posts: 26
Location: Japan
|
Hi Dietrich, mail() should add the 5th argument. Because, error mail cannot be correctly processed without this argument. Because, the correct "envelope From" may not be created without this argument. Error mail is usually sent to the envelope From of e-mail. However, the mail with which the 5th argument is not specified does not have the correct envelope From (Probably envelope from is set to apache@example.com, nobody@example.com, nobody@example.com or ...). I made the patch which makes the following modification: * The 5th argument(envelope from) will be added if it is not a safe mode. * if character code is UTF-8 (and mbstring cannot be used), "Subject" and the "From name" is encoded with MIME encode. * implementation was cleanup. http://elf.no-ip.org/~elf/contribute/usebb/2006-09-13/mail.patchplease try. Thanks,
|
|
|
#4 Wed Sep 13, 2006 2:04 pm
|
|
Developer
Registered: Apr 2004
Posts: 2224
Location: Belgium
|
This is not the case on all servers. Afaik, you only get From set to apache or nobody when sendmail (or whatever you use) is set up to not override the From header. Usually, From can be overridden by specifying it in the headers (which is what UseBB does): $headers[] = 'From: '.$from_name.' <'.$from_email.'>'; The 5th argument specifies arguments to the mailer client (usually sendmail). It is not always the case the server uses sendmail (and does not allow From to be overridden). Therefore I think adding custom sendmail parameters in the mail() statement will break on more systems than it would solve. I advice to manually add these parameters when necessary.
|
|
|
#5 Sat Sep 16, 2006 8:02 am
|
|
Member
Registered: May 2005
Posts: 26
Location: Japan
|
* 'envelope from' is not 'mail header from'. * 'envelope from' is used by SMTP protocol(MAIL FROM  . * 'envelope from' is not related to 'mail header from'. * 'envelope from' has a material role by SMTP delivery. * 'mail header from' is only used by a display, a reply, etc. of MUA. When you are running UseBB on apache, is the following row in the sent mail? Return-Path: <apache@example.com> Such mails are sent when the 5th argument is not specified. sendmail's command of famous MTA's(e.g: postfix, qmail, exim,...) command of sendmail is compatible. Thanks,
|
|
|
#6 Sat Sep 16, 2006 8:12 am
|
|
Developer
Registered: Apr 2004
Posts: 2224
Location: Belgium
|
On our testing server, the Return-Path is quite right, it's exactly the same as the sender's e-mail address (the admin's e-mail set up in UseBB). We are using ssmtp though, and not sendmail. The ssmtp configuration contains the following lines: # Set this to never rewrite the "From:" line (unless not given) and to # use that address in the "from line" of the envelope. FromLineOverride=YES Isn't there any other possibility of handling this in a decent way? I haven't tried yet using the Sender header. Maybe this solves the problem. I will also try if the 5th argument works, but I doubt it whether it works on most servers. Btw, your patch forces UseBB to send 8bit encoded e-mails all the time, even when not using UTF-8.
|
|
|
#7 Sat Sep 16, 2006 8:43 pm
|
|
Member
Registered: May 2005
Posts: 26
Location: Japan
|
Overwrite may be possible in a setup of MTA. However, it is the work which is impossible without management authority. That is, I think that it is difficult to use as solution of this problem. The 5th argument will be the addition of a setup if worrisome. + if safe_mode is disabled and $conf['use_5th_option'] is enabled, 5th argument is used. - if ( $is_safe_mode )$conf + if ( $is_safe_mode && $conf['use_5th_option'])
Quote Btw, your patch forces UseBB to send 8bit encoded e-mails all the time, even when not using UTF-8.
ok, I modified now. http://elf.no-ip.org/~elf/contribute/usebb/2006-09-17/mail.patchISO-8859-* and ISO-2022-* decide this modification to be 7 bits. What is necessary will be just to add to preg_match(), if required for others. Is there any still worried point? Thanks,
|
|
|
#8 Tue Sep 19, 2006 3:42 pm
|
|
Developer
Registered: Apr 2004
Posts: 2224
Location: Belgium
|
Patch applied to CVS. Thanks for the fix.
|