Türkce » WHM cPanel

Send Email From PHP Using SMTP Authentication

http://forum.whmdestek.com/

Go Back   WHM/cPanel Support Platform » Türkce » WHM cPanel
 

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 16.11.07, 00:20
WHMSonic's Avatar
WHM Developer
 
Join Date: Nov 2007
Posts: 119
Rep Power: 38
WHMSonic has a reputation beyond reputeWHMSonic has a reputation beyond reputeWHMSonic has a reputation beyond reputeWHMSonic has a reputation beyond reputeWHMSonic has a reputation beyond reputeWHMSonic has a reputation beyond reputeWHMSonic has a reputation beyond reputeWHMSonic has a reputation beyond reputeWHMSonic has a reputation beyond reputeWHMSonic has a reputation beyond reputeWHMSonic has a reputation beyond repute
Thumbs up Send Email From PHP Using SMTP Authentication

Hello,
This is useful article. In this article I am showing how to send email from PHP using SMTP Authentication for WHM/cPanel Servers.

Everybody knows that normal php mail functions sending emails as a nobody and this is cause to spam emails. Now check my amazing solution

Login to your root SSH and copy/use following command line to your SSH line.
PHP Code:
pear install Mail;pear install Net_SMTP;pear install Auth_SASL
After above command, you can now use the following php script and send real emails.

PHP Code:
<?php
require_once "Mail.php";
$from "MyName <name@myemail.com>";
$to "TargetName <name@targetemail.com>";
$subject "Hi!";
$body "Hi,\n\nHow are you?";
$host "mail.mailserver.com";
$username "name@myemail.com";
$password "my_password";
$headers = array ('From' => $from,
  
'To' => $to,
  
'Subject' => $subject);
$smtp Mail::factory('smtp',
  array (
'host' => $host,
    
'auth' => true,
    
'username' => $username,
    
'password' => $password));
$mail $smtp->send($to$headers$body);
if (
PEAR::isError($mail)) {
  echo(
"<p>" $mail->getMessage() . "</p>");
 } else {
  echo(
"<p>Message successfully sent!</p>");
 }
?>
__________________
Regards,
We Develop The Future
The Revolution Of WHM/cPanel Plugins ( Automatic ShoutCast & IRC )
www.whmsonic.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2  
Old 25.11.07, 21:01
tespara's Avatar
Gamzede
 
Join Date: Jun 2007
Location: dersaadet
Posts: 67
Rep Power: 48
tespara has a reputation beyond reputetespara has a reputation beyond reputetespara has a reputation beyond reputetespara has a reputation beyond reputetespara has a reputation beyond reputetespara has a reputation beyond reputetespara has a reputation beyond reputetespara has a reputation beyond reputetespara has a reputation beyond reputetespara has a reputation beyond reputetespara has a reputation beyond repute
Send a message via MSN to tespara Send a message via Skype™ to tespara
thanx WHMSonic

i do not know where mail.php which have been defined class ' (how can i call class in line 13?)
__________________
cok kaygi cekme, mukadder olan olur, takdir olunan rizkin da sana gelir.[Hz Muhammed (S.A.V)]
siir vardir ki, hikmettir. Beyân vardir ki, büyüdür.[Hz Muhammed (S.A.V)]
Kim, bir zümreye benzemeye calisirsa, o, onlardandir.[Hz Muhammed (S.A.V)]
Hikmetin basi, Allah korkusudur.[Hz Muhammed (S.A.V)]
Elif Lam Mim. insanlar "inandik" deyip kurutlacaklarinimi sanirlar [Ankebut ,1]

Last edited by tespara; 25.11.07 at 23:02.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old 26.11.07, 13:26
sinangunay's Avatar
FULL DESTEK SUNUCULAR
 
Join Date: Jul 2007
Location: biLi biLi boP
Age: 33
Posts: 1,706
Rep Power: 1079
sinangunay has a reputation beyond reputesinangunay has a reputation beyond reputesinangunay has a reputation beyond reputesinangunay has a reputation beyond reputesinangunay has a reputation beyond reputesinangunay has a reputation beyond reputesinangunay has a reputation beyond reputesinangunay has a reputation beyond reputesinangunay has a reputation beyond reputesinangunay has a reputation beyond reputesinangunay has a reputation beyond repute
Hallo, danke schön für der Artikel.
__________________
-----------------------------------------------------------------------------------------
>> LÜTFEN ÜCRETSiZ DESTEK TALEP ETMEK iciN MSN ADRESLERiMiZi EKLEMEYiNiZ. HER TÜRLÜ ÜCRETSiZ DESTEK iciN FORUMLARIMIZI KULLANINIZ. TEsEKKÜRLER <<
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old 27.11.07, 01:04
WHMSonic's Avatar
WHM Developer
 
Join Date: Nov 2007
Posts: 119
Rep Power: 38
WHMSonic has a reputation beyond reputeWHMSonic has a reputation beyond reputeWHMSonic has a reputation beyond reputeWHMSonic has a reputation beyond reputeWHMSonic has a reputation beyond reputeWHMSonic has a reputation beyond reputeWHMSonic has a reputation beyond reputeWHMSonic has a reputation beyond reputeWHMSonic has a reputation beyond reputeWHMSonic has a reputation beyond reputeWHMSonic has a reputation beyond repute
Quote:
Originally Posted by tespara View Post
thanx WHMSonic

i do not know where mail.php which have been defined class ' (how can i call class in line 13?)
Hello,
Mail.php is server side pear, but you may download this and see the full class:
http://download.pear.php.net/package/Mail-1.1.13.tgz

More information: http://pear.php.net/package/Mail
__________________
Regards,
We Develop The Future
The Revolution Of WHM/cPanel Plugins ( Automatic ShoutCast & IRC )
www.whmsonic.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old 30.05.08, 00:15
WHM VIP Member
 
Join Date: Feb 2008
Location: izmir
Age: 30
Posts: 350
Rep Power: 1007
darkwinter has a reputation beyond reputedarkwinter has a reputation beyond reputedarkwinter has a reputation beyond reputedarkwinter has a reputation beyond reputedarkwinter has a reputation beyond reputedarkwinter has a reputation beyond reputedarkwinter has a reputation beyond reputedarkwinter has a reputation beyond reputedarkwinter has a reputation beyond reputedarkwinter has a reputation beyond reputedarkwinter has a reputation beyond repute
Hello,

I got these errors, are these about PHP' s disable_functions ?

Thanks..

Regards..

Quote:
login as: root
root@72.21.49.170's password:
Last login: Thu May 29 02:02:57 2008 from
[root@whmdestek ~]# pear install Mail;pear install Net_SMTP;pear install Auth_SASL;
WARNING: channel "pear.php.net" has updated its protocols, use "channel-update p ear.php.net" to update
Did not download dependencies: pear/Net_SMTP, use --alldeps or --onlyreqdeps to download automatically

Warning: popen() has been disabled for security reasons in OS/Guess.php on line 247

Warning: popen() has been disabled for security reasons in /usr/local/lib/php/OS /Guess.php on line 247

Warning: fgets(): supplied argument is not a valid stream resource in OS/Guess.p hp on line 248

Warning: fgets(): supplied argument is not a valid stream resource in /usr/local /lib/php/OS/Guess.php on line 248

Warning: pclose(): supplied argument is not a valid stream resource in OS/Guess. php on line 256

Warning: pclose(): supplied argument is not a valid stream resource in /usr/loca l/lib/php/OS/Guess.php on line 256
pear/Mail can optionally use package "pear/Net_SMTP" (version >= 1.1.0)
downloading Mail-1.1.14.tgz ...
Starting to download Mail-1.1.14.tgz (17,537 bytes)
......done: 17,537 bytes
install ok: channel://pear.php.net/Mail-1.1.14
WARNING: channel "pear.php.net" has updated its protocols, use "channel-update p ear.php.net" to update
Did not download optional dependencies: pear/Auth_SASL, use --alldeps to downloa d automatically

Warning: popen() has been disabled for security reasons in OS/Guess.php on line 247

Warning: popen() has been disabled for security reasons in /usr/local/lib/php/OS /Guess.php on line 247

Warning: fgets(): supplied argument is not a valid stream resource in OS/Guess.p hp on line 248

Warning: fgets(): supplied argument is not a valid stream resource in /usr/local /lib/php/OS/Guess.php on line 248

Warning: pclose(): supplied argument is not a valid stream resource in OS/Guess. php on line 256

Warning: pclose(): supplied argument is not a valid stream resource in /usr/loca l/lib/php/OS/Guess.php on line 256
pear/Net_SMTP can optionally use package "pear/Auth_SASL"
downloading Net_SMTP-1.3.0.tgz ...
Starting to download Net_SMTP-1.3.0.tgz (10,259 bytes)
.....done: 10,259 bytes
downloading Net_Socket-1.0.8.tgz ...
Starting to download Net_Socket-1.0.8.tgz (5,441 bytes)
...done: 5,441 bytes
install ok: channel://pear.php.net/Net_Socket-1.0.8
install ok: channel://pear.php.net/Net_SMTP-1.3.0
WARNING: channel "pear.php.net" has updated its protocols, use "channel-update p ear.php.net" to update

Warning: popen() has been disabled for security reasons in OS/Guess.php on line 247

Warning: popen() has been disabled for security reasons in /usr/local/lib/php/OS /Guess.php on line 247

Warning: fgets(): supplied argument is not a valid stream resource in OS/Guess.p hp on line 248

Warning: fgets(): supplied argument is not a valid stream resource in /usr/local /lib/php/OS/Guess.php on line 248

Warning: pclose(): supplied argument is not a valid stream resource in OS/Guess. php on line 256

Warning: pclose(): supplied argument is not a valid stream resource in /usr/loca l/lib/php/OS/Guess.php on line 256
downloading Auth_SASL-1.0.2.tgz ...
Starting to download Auth_SASL-1.0.2.tgz (5,645 bytes)
.....done: 5,645 bytes
install ok: channel://pear.php.net/Auth_SASL-1.0.2
__________________
From hell 2 heaven..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old 10.02.09, 13:15
Atari
 
Join Date: Feb 2009
Posts: 1
Rep Power: 0
sandy is on a distinguished road
Send ack mail in SMTP authenticate mail functions

thank you for SMTP Authenticate mail coding. If you don't mind please tell me how i send acknowledge mail in that same file.

That means i have to send 2 mail() function in smtp authenticate mail

regards
sandhiya
lenovo laptops india
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Navigasyon
Menü