Jump to content

I need help with mail()

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
12 replies to this topic

#1
Xhris

Xhris

    Learning Programmer

  • Members
  • PipPipPip
  • 59 posts
OK I have been working on a mod for vbulletin. I have it ready but I need one additional item for it. I need to be able to email out a webpage in HTML to users of a specific user group. So my question is what php code do I need to setup an email feature for this? I am by far a pro at php but I am learning as I go.

If you need more info or are willing to help me please let me know what you need and we can discuss this further. If need be I may hire someone to write that part of the code for me.

#2
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
I haven't tried it myself yet, but as I understand, you don't need an setup to use mail(), it merely uses the internal sendmail program and sends it directly to user's mx-record, mail server.

#3
Brandon W

Brandon W

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 4,828 posts
Just use the mail() function, there is no need to install anything. It is a built-in command to PHP and for a manual on it, try the following links;
PHP: mail - Manual
PHP Mail Functions

The first one, is the official documentation on PHP but sometimes it can be hard to understand. So that is why I added w3schools, I learned a lot from that site and they are great!
jQuery Selectors Tutorial - jQuery Striped Table tutorial - jQuery Events - jQuery Validation

Sorry if I don't post as often as I did, I'll try to get here as much as possible! I'm working my bum off to get this scholarship and other stuff!


#4
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
mail() is "built in" so long as send mail is properly configured.

#5
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Mail() takes several parameters:

mail($to,$subject,$message,$headers,$parameters);

The headers include the From name.

PHP mail() Function
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums

#6
Xhris

Xhris

    Learning Programmer

  • Members
  • PipPipPip
  • 59 posts
Hey thanks for the info everyone has provided. I see this is going to be harder than I thought. I will read through the links above.

Thanks again

#7
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
It's really not that hard. Aside from your content, to send an email only requires one line of php, the one Xav posted.

#8
Xhris

Xhris

    Learning Programmer

  • Members
  • PipPipPip
  • 59 posts
Hi John. First off your avatar is wild man. I like that.

If I use the line Xav posted above how would I get it to pull the web page and email it out as HTML? I know if I view the source of the web page and then copy and paste it into an email script it works fine. So I can't figure out how to pull that code automatically. I sure hope I am making since here.

#9
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
to send an email as html, you need to do do two things as I know, 1) define in header that it is a html mail (mime type called) 2) make the html as if you did a webpage, and take that code and store it into a variable and put it as the content of the mail.

see example 3 of the page Xav were referring to.

#10
Xhris

Xhris

    Learning Programmer

  • Members
  • PipPipPip
  • 59 posts
I will try that. Thanks!

#11
Xhris

Xhris

    Learning Programmer

  • Members
  • PipPipPip
  • 59 posts
So would I do the variable like this?

<?php
$message = "MY HTML CODE";
?>

#12
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts

Xhris said:

So would I do the variable like this?

<?php
$message = "MY HTML CODE";
?>

use php-tags when you post.

write [ php ] before your code (with no spaces) and [/php] after.

yes. pretty much that way. and the header. you can copy that example stright off and modify it for your need I suppose.