Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Simple Email Sending

by arrow (Friar)
on Nov 08, 2005 at 16:51 UTC ( [id://506799]=perlquestion: print w/replies, xml ) Need Help??

arrow has asked for the wisdom of the Perl Monks concerning the following question:

Hi guys! It's been a long time since I've been here, and it's been a long time since I've been around Perl. I know, I know, I'm sorry. Anyway, I currently don't even have any Perl books handy, so I need a simple question answered because Super Search was taking too long.

I need to be able to send emails through CGI from a website, but I want to be able to change the date and time sent as well as sender's address perhaps, and I'd like to attach files. Now, the free server I'm using does not list the modules installed, so I'd like to use the basic Perl code for sending emails rather than using Mail or whatever.

As I said, I know this is a simple thing I want to do but I have no books or anything. Anyway, thanks in advance for any help.

Just Another Perl Wannabe

Replies are listed 'Best First'.
Re: Simple Email Sending
by davido (Cardinal) on Nov 08, 2005 at 17:01 UTC

    You want to send email via a CGI script without the use of any modules, because you cannot find out what modules the server has installed. This implies you don't have permission to be hosting CGI anyway (if you did, you could just ask what modules are installed. In fact, it's easy enough to test for a module's existance anyway.) You want to be able to spoof the timestamp, forge the sender's address, and allow for attachments. I assume you want to also allow the sender to specify the recipient.

    Be very careful what you wish for. Yes, what you want can be done (though it's rather difficult to completely eradicate any indication of where an email came from), but you will end up with a fully functional spam host. Anyone using your website will be able to use it to relay spam to anyone else, forge the sender's email address, and all the routing information will trace back to YOU.

    Update: You can communicate directly with sendmail. It's risky, and has to be done right. The script itself needs to contain within it the logic to dictate recipient email addresses. Otherwise, you have an open spam relay. The alternative would be to force the sender to establish a verified account. At that point you can open him/her up to more priviliges (such as being able to specify recipient), because hopefully you'll know who this user is, and be able to take action against him/her if (s)he uses your system in an abusive way.

    It's shocking how easily an open email webpage can be used to automate large volumes of spam. All that is needed is for the user to set up his own script that forks a few times and then uses each of the children to fill in your webmail's forms and click send. In this way, large amounts of email can be sent to large groups of recipients in a pretty short time, and eventually someone will get angry enough to blocklist your IP address.


    Dave

      For the most part this is what I want to do. By the way, let me clarify. First, the use of this website and the scripts are for me and me only, and would be accessed through a form on the webpage. Second, I'm using a basic free host on the internet. This host does not list the installed modules, and while I know I can check myself I am again ashamed to say that it has been a loonnnggg time since I messed around with Perl, so a simple operation like that would be impossible without the books I have at home. I can't get to those books until Friday, the soonest. So, in the meantime I was hoping I could at least get some ideas for continuing once I get my books.
        Grrrr. I don't know why, but I thought I was signed in when I wrote this. I am again ashamed. Someone hold me.

        Just Another Perl Wannabe
Re: Simple Email Sending
by marto (Cardinal) on Nov 08, 2005 at 16:56 UTC
Re: Simple Email Sending
by inman (Curate) on Nov 08, 2005 at 16:58 UTC
    Try Mail::Sender. This is amodule but it doesn't have any XS code so it should install OK in a CGI directory. It doesn't require an installation of sendmail or similar. It connects directly to an SMTP server and appears to do all the things that you want to do. I have only used it for simple text but the docs cover attachments etc.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://506799]
Approved by sauoq
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-16 20:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found