Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 05-16-2006, 02:32 PM   #1 (permalink)
DewKnight
Recruit
 
DewKnight's Avatar
 
Join Date: Feb 2006
Posts: 22
DewKnight is on a distinguished road
Read email account and automail

Ok, I am going to put this in here because I am pretty sure it can be done with php, but using a cgi script may be easier....

What I am trying to do... I have a list of email addresses. I have a php script right now that I can take and send whatever I want to each of those addresses. What I need it to be able to do, is read the contents of an email account (probably just every night), and then if there are any emails, I need to send them to all of the people in this list... What I have been searching for is a way to read the contents of the email account....

Some of the emails are plain text, some are html... so I would need to provide support for the html if I have to do that specifically..


any help would be appreciated.
DewKnight is offline   Reply With Quote
Old 05-16-2006, 02:51 PM   #2 (permalink)
DewKnight
Recruit
 
DewKnight's Avatar
 
Join Date: Feb 2006
Posts: 22
DewKnight is on a distinguished road
Just wanted to update that I am currently looking at imap functions for php.. I would assume that is how you would do it...
DewKnight is offline   Reply With Quote
Old 05-17-2006, 02:25 PM   #3 (permalink)
DewKnight
Recruit
 
DewKnight's Avatar
 
Join Date: Feb 2006
Posts: 22
DewKnight is on a distinguished road
Ok, I have the imap functions working so far that I have tested. What I am looking now, is to be able to send the HTML email along correctly... Right now if I just copy the body and headers and such, it does not display it as HTML correctly. So now I am just going to try to find out how to forward on the html email correctly.

If anybody knows how to do that, that would be cool. I figured I would update this thread....
DewKnight is offline   Reply With Quote
Old 05-17-2006, 02:35 PM   #4 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,444
sde is on a distinguished road
show us an example.

are you seting the content type in the headers to text/html?
__________________
Mike
sde is offline   Reply With Quote
Old 05-17-2006, 03:06 PM   #5 (permalink)
DewKnight
Recruit
 
DewKnight's Avatar
 
Join Date: Feb 2006
Posts: 22
DewKnight is on a distinguished road
Currently it sends me this:

Quote:
This is a multi-part message in MIME format.

------=_NextPart_000_0007_01C679BB.4A692D90
Content-Type: text/plain;
charset="windows-1250"
Content-Transfer-Encoding: 7bit

This is just a test



----

Russ Petrick

System Technician

Valcom LPS, Inc.

(719) 687-8093

HYPERLINK "mailto: ## email blocked ## " ## email blocked ##

HYPERLINK "http://www.valcomlps.com"http://www.valcomlps.com




--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.6.0/341 - Release Date: 5/16/2006


------=_NextPart_000_0007_01C679BB.4A692D90
Content-Type: text/html;
charset="windows-1250"
Content-Transfer-Encoding: quoted-printable

<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dwindows-1250">


<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:Arial;
color:windowtext;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
{page:Section1;}
-->
</style>

</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>This is just a test<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>----</span></font><o:p></o:p></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Russ Petrick</span></font><o:p></o:p></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>System Technician</span></font><o:p></o:p></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Valcom LPS, Inc.</span></font><o:p></o:p></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>(719) 687-8093</span></font><o:p></o:p></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><a =
href=3D"mailto: ## email blocked ##"> ## email blocked ##</a></span></font><o=
:p></o:p></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><a =
href=3D"http://www.valcomlps.com">http://www.valcomlps.com</a></span></fo=
nt><o:p></o:p></p>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

</body>

</html>
<BR>

<P><FONT SIZE=3D2>--<BR>
No virus found in this outgoing message.<BR>
Checked by AVG Free Edition.<BR>
Version: 7.1.392 / Virus Database: 268.6.0/341 - Release Date: =
5/16/2006<BR>
</FONT> </P>

------=_NextPart_000_0007_01C679BB.4A692D90--
I am not setting anything specific right now in the headers when sending it from the script... Originally I sent it to the email address using Outlook Express. So I should probably set the headers to have text/html, and then is there anything else I should set in the headers, or anything I should cut from the body before I send it along again?

Last edited by redhead; 05-18-2006 at 06:15 AM.
DewKnight is offline   Reply With Quote
Old 05-17-2006, 08:49 PM   #6 (permalink)
DewKnight
Recruit
 
DewKnight's Avatar
 
Join Date: Feb 2006
Posts: 22
DewKnight is on a distinguished road
Actually.. Since I already know how to do it with the php mail function.. I'll just use that... Thanks for the help though.


But I am wondering if you might be able to edit my email addresses out of there (or at least, make them so the spam bots can't read them). I have so far managed to keep that account free of spam. Thanks.
DewKnight is offline   Reply With Quote
Old 05-18-2006, 06:13 AM   #7 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,693
redhead is on a distinguished road
Quote:
... But I am wondering if you might be able to edit my email addresses out of there ...
Considder it done...
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 05-18-2006, 07:48 AM   #8 (permalink)
DewKnight
Recruit
 
DewKnight's Avatar
 
Join Date: Feb 2006
Posts: 22
DewKnight is on a distinguished road
Thank you much..


I am wondering another issue now.. I have this script sending out probably 300 emails or so. I want to space out the time it takes to send them so it doesn't load the server down... If I add a delay in though, it will probably go over the maximum execution time for the script? Is this something I should worry about? And how would I change the max execution time.. or keep it alive? Or would this not be affected...?
DewKnight is offline   Reply With Quote
Old 05-18-2006, 07:58 AM   #9 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,444
sde is on a distinguished road
i think safe mode has to be turned off, but this would un-restrict the max execution time:
PHP Code:
<?php
ini_set
('max_execution_time'0);
?>
is this a php script running from the command line? or is it something running in a browser? if it is the latter, another option would be to store your email array in a session variable and send 20 emails on a page load, then print a javascript redirect to the screen to have to start on the next 20 emails .. repeat until done.

if there is going to be a user watching the emails process, you could flush each email address as it gets processed so the user can see what is happening.
__________________
Mike
sde is offline   Reply With Quote
Old 05-18-2006, 08:29 AM   #10 (permalink)
DewKnight
Recruit
 
DewKnight's Avatar
 
Join Date: Feb 2006
Posts: 22
DewKnight is on a distinguished road
Currently I have one script running that the user will be watching... but that will change to a cron in the next few days. Two others are running nightly crons.

Thank you very much for your help!
DewKnight is offline   Reply With Quote
Old 11-07-2006, 07:36 AM   #11 (permalink)
DewKnight
Recruit
 
DewKnight's Avatar
 
Join Date: Feb 2006
Posts: 22
DewKnight is on a distinguished road
Well I am at the point of needing to do this again. I'll describe it again and update with some new information.

We are now on a dedicated server, so I can change anything I need. What I need to be able to do, is when one of two people sends an email to a certain email address, a script will read that email and any attachments, and then send it out to a list of people.

The main problem I was having before was that when I grabbed the email, I couldn't find a way to basically separate the headers, attachments, etc, and forward it all on correctly. If anybody has done this before, or could help me figure out how to work this, that would be awesome. I'd even be willing to give the person $15 via PayPal if we can come up with a solution that will work. Thanks for any help!
DewKnight is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP mailer . . . secure? metazai PHP 14 09-07-2005 05:28 PM


All times are GMT -8. The time now is 04:23 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting