Jump to content
php.lv forumi

mail()


DMG

Recommended Posts

Palīdziet man lūdz šādā lietā! Ik reiz kad sūtu e-mailu man pie sūtītāja parādās "Kam: un mans e-mails". Kā var dabūt nost to "Kam: "

Šobrīd lietoju:

 

$headers = "From: $email" . "\r\n" .

'X-Mailer: PHP/' . phpversion() . "\r\n" .

"MIME-Version: 1.0\r\n" .

"Content-Type: text/html; charset=UTF-8\r\n" .

"Content-Transfer-Encoding: 8bit\r\n\r\n";

 

Ir kādas idejas?

Link to comment
Share on other sites

$headers = "From: $email" . "\r\n" .

'X-Mailer: PHP/' . phpversion() . "\r\n" .

"MIME-Version: 1.0\r\n" .

"Content-Type: text/html; charset=UTF-8\r\n" .

"Content-Transfer-Encoding: 8bit\r\n\r\n";

 

@mail($mans,$vards,$zina,$headers);

 

Ceru ka skaidrot mainīgs nevajag jo izņemot hederi tur tāpat ir vienārši teksts attiecīgais vai mans emails :)

 

Heh laikam sapratu savu kļūdu šai jautājumā! Bet nekas paturpināšu domu un pajautāšu kā var uzlikt, lai kad nosūtu e-mailu tai lodziņā "From" Parādītos tikai piemēram DMG? Ja izlaboju $headers = "From: DMG" . "\r\n" Man parādās DMG@mana servera adrese

Gribētos lai parādās tikai tas DMG.

Edited by DMG
Link to comment
Share on other sites

Nebūs vis tā, Veber! ;)

Problēma ir tāda, ka PHP automātiski padod to adresi kas definēta (laikam php.ini failā).

From: bla bla ir tikai header - tas netiek izmantots SMTP protokola sākumdaļā:

telnet mail.islandnet.com 25
220 Islandnet.com ESMTP server ready
helo a.b.c
250 mail.islandnet.com Hello x [YOUR_IP_ADDRESS]
mail from:<YOUR_ADDRESS>
250 <YOUR_ADDRESS> is syntactically correct
rcpt to:<YOUR_ADDRESS>
250 <YOUR_ADDRESS> verified
data
354 Enter message, ending with "." on a line by itself
From: Bugs Bunny
To: Daffy Duck
Subject: Loony Toons!

Hi there!
.
250 OK id=1778te-0009TT-00
quit
221 mail.islandnet.com closing connection

Piemēru nekaunīgi paņēmu no šejienes

Kā redzi, tad From headerī var ierakstīt vienu lietu (Bugs Bunny), bet MAIL FROM: protokola sākumposmā - citu adresi.

Risinājums:

izlasam par mail() funkciju

šo te daļu:

additional_parameters (optional)

 

The additional_parameters parameter can be used to pass an additional parameter to the program configured to use when sending mail using the sendmail_path configuration setting. For example, this can be used to set the envelope sender address when using sendmail with the -f sendmail option.

 

The user that the webserver runs as should be added as a trusted user to the sendmail configuration to prevent a 'X-Warning' header from being added to the message when the envelope sender (-f) is set using this method. For sendmail users, this file is /etc/mail/trusted-users.

Tātad - mail('[email protected]', $subject, $message, $headers,'[email protected]');

N.B. starp parametru -f un adresi nav atstarpe!

Link to comment
Share on other sites

×
×
  • Create New...