Hola.

Seguimos con los howtos este how to tambien es corto simplemente hace lo que se necesita
ENVIAR CORREOS CON PHP

Requerimientos:

  • Conocimiento basico de PHP
  • PHP previamente instalado
  • Servidor de correo previamente instalado

Primero que nada necesitamos un formulario con digamos 2 campos que son:

  • El correo del destinatario
  • El Mensaje que le vamos a enviar

Aqui esta el codigo para el archivo form_mail.html

<form method="post" action="sendmail.php">
    <table width="25%" border="0">
        <tr>
            <td colspan="2">Envio de correos </td>
        </tr>
        <tr>
            <td width="10%">Para</td>
            <td width="90%">
                <input name="email" type="text" id="email" />
            </td>
        </tr>
        <tr>
            <td valign="top">Mensaje</td>
            <td>
                <textarea name="mensaje" cols="50" rows="5" id="mensaje"></textarea>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <input type="submit" name="Submit" value="Enviar" />
            </td>
        </tr>
    </table>
</form>

Como podemos observar el action de la forma es un archivo llamado sendmail.php que se encargara de enviar el correo.

Y por ultimo vamos a crear nuestro archivo que enviara el correo
Aqui esta el codigo del archivo sendmail.php

/* VAMOS A HACERNOS LA VIDA MAS FACIL 
 * EXTRAEMOS DEL REQUEST LOS DATOS Y LOS PASAMOS AUTOMATICAMENTE A VARIABLES
 * DE ESTA MANERA NUESTRAS VARIABLES TENDRAN EL MISMO NOMBRE DE LOS CAMPOS DEL FORMULARIO
*/
/*
 * Comentario extraido de http://www.php-es.com/function.mail.html
 * (Sólo en Windows) Cuando PHP sostiene comunicación con el servidor SMTP directamente, 
 * si un punto es encontrado al comienzo de la línea, éste es removido. 
 * Para contrarestar este comportamiento, reemplace estas ocurrencias con dos puntos
*/
$mensaje=str_replace("\n.", "\n..", $mensaje);

// LE APLICAMOS UN AJUSTE DE LINEA AL TEXTO
$mensaje=wordwrap($mensaje,70);
// ESPECIFICAMOS EN LAS CABECERAS QUE ES EN FORMATO HTML PUENEN REMOVERLAS SI 
// EL FORMATO QUE DESEN ENVIAR ES SOLO TEXT0
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// CREAMOS LA CABECERA PARA QUE APARESCA QUIEN LO ENVIO
$headers .= 'From:<micorreo@miservidor>' . "\r\n";

//Y LISTO ENVIAMOS EL CORREO ASI DE FACIL :D
mail($email,”Titulo del corrreo”,$mensaje,$headers);


como ya es costumbre aqui esta el

46 Respuestas para “Enviar correo con PHP”

  1. Dante
    desde Mexico Dijo:

    Andale Wama haciendo mas mejor compartiendo el codigo con la raza, hechale ganas

    Responder

  2. sdfsdf
    desde Spain Dijo:

    dfvdfvdv

    Responder

  3. victor
    desde Bolivia Dijo:

    Creo que el correo jamas llegara a destino ya que olvidaste algo fundamental, reemplazar “correodestino” por la variable correspondiente:

    cambiar esto:
    mail(“correodestino”,”Titulo del corrreo”,”$mensaje”,$headers);

    por esto:
    mail(“$email”,”Titulo del corrreo”,”$mensaje”,$headers);

    aun asi falta explicar como es que $email logra tener el valor del form.

    Responder

  4. victor
    desde Bolivia Dijo:

    otra cosa las comillas estan por demas…

    mail($email,”Titulo del corrreo”,$mensaje,$headers);

    Responder

    Ruben Omar August 27th, 2008 8:26 pm

    Ruben Omar desde Mexico Dijo:

    Mil gracias por el comentario ya quedo actualizado, :P

    Responder

  5. cristian
    desde Colombia Dijo:

    hola

    Responder

  6. Masilva
    desde Venezuela Dijo:

    El archivo sendmail.php que viene en el archivo zip que se descarga viene vacio

    Responder

    Bliser May 10th, 2010 11:31 am

    Bliser desde Peru Dijo:

    se necesita de un servidor de correos para que funcione el script

    Responder

  7. gift ideas for women
    desde Dijo:

    My cousin is officiating At my tomorrow and does not need something, and this was the perfect gift for that man who likes to produce breakfast
    for his kids and anyone else in work.

    Responder

  8. Sabrina
    desde Dijo:

    Dating sites are for finding sex partners…not lifetime partners- thats nonsense people delude themselves with.

    Responder

  9. lasertest
    desde Dijo:

    Aw, this was a really nice post. Finding the time
    and actual effort to create a good article_ but what can I say_ I
    put things off a whole lot and don’t seem to get anything done.

    Responder

  10. tips to quit smoking
    desde United States Dijo:

    Hi, constantly i used tips to quit smoking check website posts here in the early hours
    in the break of day, since i like to gain knowledge of more and more.

    Responder

  11. plan culturel artistique
    desde Dijo:

    Aangezien mensen al zo lang – en vaak
    - drugs еn seks mеt elkaar
    combineren, z᧐u је denken dаt ᴡe ⅾе
    twee inmiddels uitstekend begrijpen.

    Responder

  12. shadow fight 2 apk real
    desde United States Dijo:

    Great site you have got here.. It’s hard to find high quality
    writing like yours nowadays. I seriously appreciate individuals like you!
    Take care!!

    Responder

  13. Lottery Eth
    desde Dijo:

    Not only in quality, in terms of quantity as well, DISH Network has crafted its name in the industry.

    In particular, you may want to browse through the following collections.

    The scene of Katniss Everdeen hunting in the woods of District 12.
    Graphs with origins other than zero distort gradients
    and variations.

    Responder

  14. Bob
    desde Dijo:

    Para fazer coelhinho, passe molde dele para E.V.A usando uma magrelo de churrasco para n

    Responder

  15. khoa hoc seo
    desde Dijo:

    Nice post. I learn something new and challenging on websites I stumbleupon everyday.

    It’s always helpful to read articles from other writers and practice something from
    their web sites.

    Responder

  16. pedacitodecielo.com
    desde Dijo:

    I would like to show my admiration for your generosity supporting people that
    actually need help on the subject matter. Your personal dedication to getting the solution across has been extremely powerful
    and have all the time enabled employees like me to realize their goals.
    This helpful instruction can mean a whole lot a person like me and additionally to my colleagues.
    With thanks; from all of us.

    Responder

  17. dao tao seo hcm
    desde Dijo:

    Hello, you used to write fantastic, but the last few posts have been kinda boring?

    I miss your tremendous writings. Past several posts are just a little bit out of track!
    come on!

    Responder

  18. web site
    desde Dijo:

    Era, dessarte, uma oportunidade

    Responder

  19. web site
    desde Dijo:

    Era, dessarte, uma oportunidade

    Responder

  20. SGP CREDIT
    desde Dijo:

    Some truly grand work on behalf oof the owner
    of this internet site, deadd great subject material.

    my page SGP CREDIT

    Responder

  21. www.tmz.com
    desde Dijo:

    Aѕ soon aѕ I oᥙnd this web sіtе
    I ᴡеnt οn reԁԀіt
    tο ѕhаге ѕomе ߋf
    the ⅼߋѵe ѡіtһ them.

    Hеre іѕ mmу ԝeb paɡе :: ⅯacFɑrⅼɑne Gгoսⲣ Μагҝ Сսrгу;
    http://www.tmz.com,

    Responder

  22. __________ ____ ________
    desde Dijo:

    I’m no longer sure where you are getting your info, however
    good topic. I must spend some time finding
    out more or figuring out more. Thank you for great info I was searching for this info for my mission.

    Responder

  23. Best tactical Gear
    desde Dijo:

    Apple Watch offeers a lot beyond health monitoring that even at $350, I am bought.

    Take a lokk at my blog post; Best tactical Gear

    Responder

  24. blue light color filter
    desde Dijo:

    Please let me know if you’re looking for a article author for your
    blog. You have some really great posts and I think
    I would be a good asset. If you ever want to take some
    of the load off, I’d really like to write some material for
    your blog in exchange for a link back to mine. Please blast me an email if interested.
    Thanks!

    Responder

  25. round metal drying rack
    desde Dijo:

    Hellο it’s me, I am alsо νіѕіting thіѕ ᴡеb ѕіtе rеɡulɑrⅼy,
    tһіѕ ԝeƄ ρaցе іs
    tгuⅼу nicе аnd tһе
    սѕeгs arе гeɑllу ѕһaring gօοd thοᥙցһts.

    Responder

  26. etsy
    desde Republic Of Korea Dijo:

    You actually make it appear so easy along with your presentation but I in finding this topic to be actually one thing
    that I believe I would by no means understand. It seems too complicated and extremely large
    for me. I am looking forward in your subsequent post, I
    will try to get the grasp of it!

    Responder

  27. esponja konjac ecotools
    desde Dijo:

    If some ߋne needs expert view on the topic of running a
    Ьlⲟɡ aftегѡarԀ і гeϲօmmеnd hіm/һeг tο ⲣay a ᴠiѕіt thіs ѡebρаɡе, Қеер ᥙρ tһе ɡߋоd ϳߋb.

    Feel frее
    tο sᥙгf t᧐ mʏ ѡѡeƅ
    ƅⅼoɡ; esponja konjac ecotools

    Responder

  28. ___ _____ _______
    desde Dijo:

    All listed Makkah resorts can be booked online.

    Responder

  29. ___ _____ ___
    desde Switzerland Dijo:

    Anjum Accommodations – Makkah, All Rights Reserved.

    Responder

  30. poker queen
    desde Dijo:

    A great poker tip to win the poker game is by confusing people which is generally known as bluffing.
    The bottom of the page gives some more ideas and perspectives on deception in poker.

    Once you have formed a friendship with the Sim,
    try out some of the romantic interactions with the Sim.
    Even it’s not easy to get six pack, you can easily achieve
    it as long as you got discipline and patience to the numerous exercises in repetition for a long period of time.

    Responder

  31. _____ ______
    desde Dijo:

    Qatar Airways is predicated in Doha, the capital of
    Qatar.

    Responder

  32. http://hustlehubmentoring.com/groups/singapore-the-flow-east-coast/
    desde Switzerland Dijo:

    By examining the brand new expertise that has
    quickly swept the global scene, we start to discern that the worldwide presence of the Internet has
    severe future implications for intercultural
    communication.

    Responder

  33. stone street furniture
    desde Dijo:

    I am reɑlly іnsрlіrеd alօng ᴡitһ
    үօᥙг wrіtіng tɑlentѕ ɑnd aⅼѕo ԝith thе layօᥙt tt᧐ ʏοսг Ƅlοɡ.
    Iѕ tһаt thіs a ρaіⅾ ѕᥙЬjесt
    օr Ԁііԁ ʏоս сսѕtօmіze іt
    yοᥙгѕеⅼf?
    Anyԝау қееp սр tһеe еⲭcеllent ԛuаⅼіtʏ ѡrіtіng, it іѕ ᥙncߋmmօn tо ⅼоoҝ а
    nicе Ƅⅼߋg lіκe thіѕ one tһеѕе ɗаүѕ..

    Fееⅼ fгeе to vіѕіt
    mү bⅼⲟց
    stone street furniture

    Responder

  34. steel driveway grates
    desde Dijo:

    Τhis inf᧐ is іnvаlᥙaЬⅼe.
    Ηοԝ сɑn I find οᥙt mогe?

    Feеl fгeе tߋ ѕᥙгf t᧐ mʏ ԝeƄ-sitе
    steel driveway grates

    Responder

  35. ___ _____ ___
    desde Dijo:

    Have tried many accommodations in Dubai in the past.

    Responder

  36. sportowefakty _u_el tabela
    desde Dijo:

    magnificent issues altogether, you just won a emblem new reader.
    What might you suggest about your post that you simply
    made a few days in the past? Any positive?

    Responder

  37. calgary pro painters
    desde Dijo:

    I have been surfing online more than five hours today
    for calgary pro painters & Enviar correo con PHP , yet I never
    found any interesting article like yours. It is pretty
    worth enough for me. In my view, if all web owners and bloggers made good content as you did, the internet will be much more useful than ever before.

    Responder

  38. projektowanie wn_trz program online
    desde Dijo:

    Pretty component of content. I simply stumbled upon your site and in accession capital to
    claim that I acquire actually enjoyed account your blog posts.
    Anyway I will be subscribing for your feeds and even I fulfillment
    you get admission to consistently quickly.

    Responder

  39. ____________
    desde Thailand Dijo:

    I was excited to uncover this page. I want to to thank you for your time
    for this particularly wonderful read!! I definitely savored every bit of it and I
    have you saved to fav to see new stuff in your site.

    Responder

  40. _____ _______
    desde Dijo:

    A unified kingdom was founded circa 3100 BC by King Narmer,
    and a series of dynasties dominated in Egypt for the following three millennia.

    Responder

  41. deck drain covers
    desde Dijo:

    I liκe thіѕ Ƅ᧐оg
    ѕο mսch, ƅоߋқmɑrκed.

    mү һοmeⲣаցе
    deck drain covers

    Responder

  42. n_p ti_n cf mobile
    desde United States Dijo:

    Fastidious respond in return off this difficulty with firm
    arguments and explaining the whole thing about that.

    Responder

  43. john wick chapter 2 online
    desde Dijo:

    Per Deadline, original stars Lance Reddick, John Leguizamo, Bridget Moynahan and Tom Sadowski may also
    be returning for John Wick: Chapter 2. Reddick will reprise the
    character of Charon, the Continental Hotel manager who gives lodging for
    a range of assassins that are fascinating.

    My web page john wick chapter 2 online

    Responder

  44. bezoek de site
    desde Netherlands Dijo:

    Great post. I was checking constantly this blog and I am impressed!

    Very useful information particularly the last part :) I care for such information much.
    I was looking for this particular information for a very long time.
    Thank you and good luck.

    Responder

Responder