Jump to content
xisto Community
haitamlong

Php Send Mail Through Smtp

Recommended Posts

What you are probably really wanting to use is the mail() function which is used pretty widely with PHP.

 

I personally use this function on my local PC which is connectted persistently through a DSL connection (256k download and 126 upload tested) my test scripts run as long as they are coded properly and so I test them to my own e-mail address to check for errors or to make improvements to them.

 

If you are simply wanting to use PHP to send e-mail then just click the link above that I provided and if you have any difficulties sending to your own email then you could post again with those problems with any errors encountered or anomolies with your script and I will be glad to help you with it. You could also PM me about the problems real or imagened. Welcome to the world of PHP here on Xisto.

Edited by Houdini (see edit history)

Share this post


Link to post
Share on other sites

If you're searching for a way to send via SMTP, then I guess you don't mean the mail() function as you would find tonnes of information on that.There's an alternative way, using PHP and sockets to connect to the SMTP server and send the commands that are requested by the SMTP server, the problem however is that most SMTP servers are set up to not allow RELAYing of messages from outside without SMTP authentification that you are actually an allowed user to use that SMTP server, reason being many SPAM mailers could use these servers to distribute their mail if they were not secured against it.If you want to find ideas, look for SMTP via Telnet methods, and then learn PHP sockets to do the exact same thing, as the method is just the same, except you're using PHP to do what you would do in Telnet.You will probably also need to read the RFC on SMTP so you can understand how verification and authentification is done, as well as limitations on it.Cheers,MC

Share this post


Link to post
Share on other sites

Yep, you basically could build an SMTP client with PHP. It's actually quite easy if you understand protocols in general and have some experience in socket programming.

What I suggest is that you read RFC821 (for example here: http://www.ietf.org/rfc/rfc0821.txt) and then take a look at PHP manual for sockets. If you want example code, you'll be able to find tons at least in C language.

I remember reading about an open source project for a PHP class containing bunch of emailing functionalities including smtp. Unfortunately I wasn't able to find anything on it right now. And I do believe PEAR package has some sort of SMPT implementation.

Share this post


Link to post
Share on other sites

Yep, you basically could build an SMTP client with PHP. It's actually quite easy if you understand protocols in general and have some experience in socket programming.
What I suggest is that you read RFC821 (for example here: http://www.ietf.org/rfc/rfc0821.txt) and then take a look at PHP manual for sockets. If you want example code, you'll be able to find tons at least in C language.

I remember reading about an open source project for a PHP class containing bunch of emailing functionalities including smtp. Unfortunately I wasn't able to find anything on it right now. And I do believe PEAR package has some sort of SMPT implementation.


this site dunt work'n bro
if ya have anysite be da same plz post it
thx

Share this post


Link to post
Share on other sites

How to send mail using gmail as a smtp server

Php Send Mail Through Smtp

 

Hi

I tired a lot of scripts to send mail throug smtp and no one of them was working correctly.

One of them sends mail to spam because there were no authentication.

One of them worked cool but after sending 30-40 mail gave me an error

Error: Language string failed to load: connect_host

now I'm mixed up and really need a mail sender that it really work

Thanks a lot

Masoudmpour@yahoo.Com

 

-reply by Bardiya

Share this post


Link to post
Share on other sites

I have been using phpMailer for quite sometime. However, for some reason, it is unable to send mail anymore. I don't recall changing any of the configurations either. I was using gmail as the SMTP server. But now, I have switched back to the mail function, which always works.

Share this post


Link to post
Share on other sites
cannot send mail trough phpPhp Send Mail Through Smtp

 hello every one .

could anyone just give me the direct code which sends the mail from a smtp.

I have alredy used phpmailer() but is nt wrking for me it gives some error as smtp error : mail not accepted by the (abc@gmail.Com ) . This is the example id not the real one.

Please help

-question by Pramod

 

Share this post


Link to post
Share on other sites

I am a new member here, but I am using PHP from long time .I have used SendMail on windows system.Also have knoledge to work on linux systemSolution: First you have to download Sendmail utility. Make changes in php.ini and sendmail.ini files. PHP.ini 1. set path of sendmail.exe file. example: sendmail_path = "C:\wamp\sendmail\sendmail.exe -t" 2. disable smtp by puting ";" in front of SMTP= example : ;SMTP = localhost sendmail.ini 1. Make setings of smtp port example : smtp_port=25 2. set smtp server name example: mail.domain.com 3. Set pop3 server name example : pop3_server=mail.domain.com 4. Set POP3 user name example : pop3_username=username@domain.com 5. Set Password example : pop3_password=****** Now restart apache server. and all is set.Hope this helps you and every thing works fineHere is attachment for post-7593-1170926246_thumb.jpgRegards------------Yogesh GAdiya

Share this post


Link to post
Share on other sites

I am a new member here, but I am using PHP from long time .I have used SendMail on windows system.
Also have knoledge to work on linux system

Solution:
First you have to download Sendmail utility.
Make changes in php.ini and sendmail.ini files.
PHP.ini
1. set path of sendmail.exe file. example: sendmail_path = "C:\wamp\sendmail\sendmail.exe -t"
2. disable smtp by puting ";" in front of SMTP= example : ;SMTP = localhost
sendmail.ini
1. Make setings of smtp port example : smtp_port=25
2. set smtp server name example: mail.domain.com
3. Set pop3 server name example : pop3_server=mail.domain.com
4. Set POP3 user name example : pop3_username=username@domain.com
5. Set Password example : pop3_password=******
Now restart apache server. and all is set.
Hope this helps you and every thing works fine

Here is attachment for post-7593-1170926246_thumb.jpg




Regards
------------

Yogesh GAdiya


Hi


in windows we need to install any SMTP server or not..if yes please give me all the steps of sending mail through php in windows platform...i mean the smtp software name...and steps to do that..

i did all the steps what u wrote...but i think thts not enough ...

please help me i am new to PHP...

Share this post


Link to post
Share on other sites

Hi in windows we need to install any SMTP server or not..if yes please give me all the steps of sending mail through php in windows platform...i mean the smtp software name...and steps to do that..
i did all the steps what u wrote...but i think thts not enough ...
please help me i am new to PHP...

Please avoid double-posting, your question looks strangely similar to the one you asked here : http://forums.xisto.com/topic/97384-topic/?findpost=1064405010
Regards
yordan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.