Stats: 3,190,628 members, 7,941,421 topics. Date: Friday, 06 September 2024 at 06:40 AM |
Nairaland Forum / Science/Technology / Programming / How Do I Code And Configure Smtp To Send Mail In My Script (1492 Views)
I'm Learning Programming But... How Can I Code (as In ... In Real Life)??? / How Can I Code This In Php/html? / Php Send Mail Wilth Gmail SMTP (2) (3) (4)
How Do I Code And Configure Smtp To Send Mail In My Script by ebenz1(m): 6:11pm On Mar 22, 2010 |
how do i code and configure smtp to send mail in my script. pls help me o ive tried all my possible best. |
Re: How Do I Code And Configure Smtp To Send Mail In My Script by dellnet: 6:13pm On Mar 22, 2010 |
what kind of script? |
Re: How Do I Code And Configure Smtp To Send Mail In My Script by ebenz1(m): 6:21pm On Mar 22, 2010 |
its a php script |
Re: How Do I Code And Configure Smtp To Send Mail In My Script by dellnet: 6:35pm On Mar 22, 2010 |
<?php $to = 'example@host.com; //change this to valid email address $subject = 'subject'; //the subject goes here $message = 'message'; //this is the message body $sender = 'From:webmaster@example.com'; //this is the senders address if (!mail($to, $subject, $message,$sender)) { echo 'error in sending mail'; } ?> Change to a valid email address, subject, message etc as indicated in the comments. Remember all are string. PHP 4 and above. |
Re: How Do I Code And Configure Smtp To Send Mail In My Script by Nobody: 11:17pm On Mar 22, 2010 |
I don't understand this. |
Re: How Do I Code And Configure Smtp To Send Mail In My Script by dellnet: 6:31am On Mar 23, 2010 |
Ok step by step. 1. Declare variables as follows: a. $to which is the email address to send to b. $subject which is the subject of the email c. $message which is the message body d. $sender which is the sender of the email in the format of From:xx@xx.Bleep 2. call mail with the variables as parameter which is mail($to, $subject, $message, $sender) thats all the smtp server will send the mail. Just try it. Practice make you know things in programming not theory. |
Re: How Do I Code And Configure Smtp To Send Mail In My Script by ebenz1(m): 4:04pm On Mar 23, 2010 |
but i learn i need to configure smtp in php.ini before it can work. how can i find this file on my hosting server |
Re: How Do I Code And Configure Smtp To Send Mail In My Script by dellnet: 6:42pm On Mar 23, 2010 |
it is in the directory you installed php. just click start->search (on XP) and search for php.ini on your local drive. |
Re: How Do I Code And Configure Smtp To Send Mail In My Script by dellnet: 6:55pm On Mar 23, 2010 |
do you own the hosting server? |
Re: How Do I Code And Configure Smtp To Send Mail In My Script by ebenz1(m): 6:57pm On Mar 23, 2010 |
no . i mean on my hosting server |
Re: How Do I Code And Configure Smtp To Send Mail In My Script by dellnet: 7:44pm On Mar 23, 2010 |
you need to verify with your host if they have php enabled on the server usually php is a common thing. |
Re: How Do I Code And Configure Smtp To Send Mail In My Script by sayhi2ay(m): 4:55pm On Mar 24, 2010 |
with that snippet, you dont need to configure anything in your php.ini usually, the mail functions would have been turned on. again, if you had used the code , you'd see it works, you can always use <?php phpinfo(); ?> to see all your server configurations |
Re: How Do I Code And Configure Smtp To Send Mail In My Script by ebenz1(m): 6:38pm On Mar 24, 2010 |
Thanks a lot guys.Maybe its beacause i didnt subscribe the mail forwading service with my host. whenever i run that script i always see a reply error message in my host webmail usually from an address that looks like mailerdemon bla bla bla. |
Re: How Do I Code And Configure Smtp To Send Mail In My Script by Ralvy(m): 10:37pm On Mar 24, 2010 |
Well, it really depends on your server environment and configuration. Dellnet has used the standard mail() function which should be sufficient for a simple mail script. However, it's possible that your host has the standard mail() function disabled for security reasons, in such cases you're required to dispatch mails via a configured SMTP Server and that is possibly where your problem lies as most SMTP servers are setup to reject relaying mails without SMTP authentication that you're permitted to relay e-mails using that server, one major reason being "spam". Do you have basic knowledge or considerable experience in socket programming? It might be easier for you to just build an SMTP client. I remember doing one in C language for a client, will probably search my archives for a copy. -[n3rve] |
Re: How Do I Code And Configure Smtp To Send Mail In My Script by uanda(m): 3:27am On Aug 16, 2013 |
Hello Php gurus, can someone past scripts for sending mails with gmail SMTP. My host disabled their mail function and mails r not being delevered with the standard mail functions. |
Re: How Do I Code And Configure Smtp To Send Mail In My Script by afridigit(m): 11:03pm On Aug 16, 2013 |
Send me a mail to ukagwu@afridigit.net if u still need the codes. i will give to you free. |
(1) (Reply)
Advise On Good Java Web Application Framework / Android Creation And Software / NPOWER Shoddiness
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 17 |