Help Please
I am very new to the Perl game and need some help
I have a Perl application which works fine and can output some plain text information that I need to send to selected users via e-mail.
The e-mail address are under the $addr and the information that I whish to put in the e-mail message are held in $msg
I have installed and have working Sendmail the script that I have come up with so far is -
sub send_mail
-
{
-
my $addr = shift;
-
my $msg = shift;'
-
my %mail;
-
my $body;
-
-
# start a new mail message
-
-
# setup the headers
-
%mail = (
-
To => 'fred@me.net',
-
From => 'bob@me.net',
-
subject =>' Warning information',
-
Message =>'This mail message was generated automatically
-
and has been sent to you because you have requested certain this information via email’,
-
);
-
-
# close the mail object (causes it to be sent)
-
sendmail(%mail) or die $Mail::Sendmail::error;
-
-
print "OK. Log says:\n", $Mail::Sendmail::log;
-
This sends an e-mail as shown above fine
How do I get the $addr tag to automatically put the recipients email address into the to field?
Secondly how do I get the $msg tag to automatically put its information into the e-mail message.
This will I guess be either very easy or am I asking the impossible?
I have now spent severally days searching the net and trying to work this out so any help would be most appreciated
6 1878 KevinADC 4,059
Recognized Expert Specialist - $msg = "something";
-
@list = (a list of email recipients);
-
-
foreach $person (@list) {
-
send_mail($person,$msg)
-
}
Hi KevinADC
Thanks for the reply
Being new at Perl I don’t think I fully explained myself.
The $addr has the e-maill address that I want to use what I cant see is how to put the value/ email address that $addr has in to the e-mail to field.
Thanks
KevinADC 4,059
Recognized Expert Specialist - sub send_mail
-
{
-
my $addr = shift;
-
my $msg = shift;'
-
my %mail;
-
my $body;
-
-
# start a new mail message
-
-
# setup the headers
-
%mail = (
-
To => $addr,
-
From => 'bob@me.net',
-
subject =>' Warning information',
-
Message =>$msg,
-
);
-
-
# close the mail object (causes it to be sent)
-
sendmail(%mail) or die $Mail::Sendmail::error;
-
-
print "OK. Log says:\n", $Mail::Sendmail::log;
Hi
Thanks for all the help
I am almost there now all the right information is now sent in the email
The only problem now is the formatting of the body of the email
as you can see below all the lines of text are in the wrong order
Subject: Warning information
:
Information 10-May-2007 2320z country: hungary-Ha zone: 15 baa->dx: 1603km rule: 6
: conditions or rare stations be reported by email.
Date: Thu, 10 May 2007 23:20:59 +0000
Content-Transfer-Encoding: 8bit
To: me@cs.net
and has been sent to you because you have requested certain propagation
: This mail message was generated automatically by software
Mime-Version: 1.0
The message should read
This mail message was generated automatically by software
and has been sent to you because you have requested certain propagation
conditions or rare stations be reported by email.
Information 10-May-2007 2320z country: hungary-Ha zone: 15 dxg->dx: 1603km rule: 6
I am so close now to getting this working I have spent the last day reading and trying sendmail settings with limited success.
Also
Date: Thu, 10 May 2007 23:20:59 +0000
Content-Transfer-Encoding: 8bit
To: me@cw.net
Also get put in the email
Thanks for any help
Keith
KevinADC 4,059
Recognized Expert Specialist
Message =>"whatever you want here\n$msg";
Many thanks for all your help
All is now working as I want it to
I have learnt a lot along the way
Many thanks again
Keith
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: jim |
last post by:
Hello,
I am having a problem w/SendMail reporting: " No recipient addresses
found in header".
Funny thing is though, I properly recieve the email message.
Thanks for your help.
-jim
|
by: janet |
last post by:
HI,
I had a question on auto-commit in DB2 EEE V8 on AIX V5.
Here is my example..
there are two script A.sh , B.SQL
A.sh is following:
|
by: xzzy |
last post by:
I need to automate a report in a different database (and thank yous to Terry
Kreft for pointing me in the right direction).
below is the code with the one line that does not work, marked: 'Does not
Work'
It appears that the type of object returned from the "AllReports" collection
is not a report object.
=>> I need it to be an object of type report.
|
by: Dave N |
last post by:
I have a list box with the directory path of an OLE object and I want to
automate adding the object to my tblEmbededObjectst table when a Save button
is pressed. I can import them manually but con not figure out a way to auto
mate it.
|
by: Chris |
last post by:
Before I started to create table, etc to track unique form field record
number assigments I thought I'd check to see if there is now a better way to
do this in .NET.
I have a parent form (table) and children form (table). Relationship equals
one to many. I'd like to auto number the fields accordingly and traditionaly
I assign a unique number based on a table value that I retrieve + 1.
i.e.
Parent record field value = 1
Children record...
| |
by: Shelly |
last post by:
I want to be able to create a sendmail account by commands sent from a web
page. I am using php. After everything is done, I want to enter his info
into the database (easy) and create this sendmail account. Can anyone give
me pointers to explanations/excamples? I have done a quick search on the
web, but haven't turned up anything. In addition, I do NOT want to create a
regular user account on the server -- only a sendmail account.
...
|
by: Phil Latio |
last post by:
I have 2 virtually identical tables and wish to move data between them.
Basically one table is called "live_table" and the other is named
"suspended_table" and the only difference is that the primary key in the
"suspended_table" is an auto incremented integer where as "live_table"
primary key is just a standard integer.
Here's the life-cycle:
1. Record gets entered into "suspended_table"
2. Record checked and then inserted into...
|
by: Liam.M |
last post by:
HEY GUYS,
need some urgent help here....I am querying my database based on a
DueDate field...and want to send an automated email to anyone that
falls within two months PRIOR to this "DueDate", so far the Code is
querying the database and trying to run a module I created, title
SendMail, however it is having trouble sending the email for some
reason... any suggestions as to why....here is the code:
|
by: Neo |
last post by:
Hello All,
I found that ASP.net website only accepts code withing site directory.
This creates big hurdle in shairng code. How to share code between two
websites, like the way share between two non-website code?
-Pravin
|
by: swangdb |
last post by:
I have a Sun Server running Solaris 10 and Sendmail 8.13.7. I have
Majordomo and Listproc installed on this server and they work. I have
several production majordomo and listproc mailing lists installed on
this server and they work.
I am trying to get Mailman to work on this server and so far, no luck.
I installed the software (Mailman 2.1.8 and Python 2.4.3), reconfigured
mm_cfg.py, started the software, added the cron entries,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |